Open Side Menu Go to the Top

03-14-2013 , 09:04 AM
Quote:
Originally Posted by DDLJ
I have a bunch of Hand Histories that have a slight formatting issue. They HH are able to be imported to HM2 just fine, but NoteCaddy is unable to read them and create notes. I have contacted NC support and they are unable/ unwilling to help. Basically the issue is that in one line the HH's I have will say "--- Dealing flop [AD,QD,3c]" while I need it to say "--- Dealing flop [AD, QD, 3c]". The only difference is that I need to add a space after the commas. Once it does that NoteCaddy is able to read the HH and take notes on it.

I'm wondering what language I would need to do something like this and if anyone can lead me to someone who can write something like this. Also how much would it cost me to hire someone to write this for me?
Quote:
Originally Posted by well named
$ cat file | sed 's/\[([AKQJT2-9]{1}[HDSChdsc]{1}),([AKQJT2-9]{1}[HDSChdsc]{1}),([AKQJT2-9]{1}[HDSChdsc]{1})\]/\[\1, \2, \3\]/g' > newfile

something like that?

edit: added lower case heart/spade/diamond/club since you had both, but probably it's consistent and you only need one or the other
Lol. I doubt that the guy who posted the question will even understand WTF this answer is supposed to mean from the way he asked the question.

To answer the question, I'd guess you pay about 10$ for this if you have to. What well named posted is simply using the Unix/Linux+sed shell to get the files on the format you want. You can get this done with any language with decent regular expression support like Python,Ruby,Perl and whatnot.

Basically post "Easy file conversion/RegExp, script needed for YOUROSHERE: 10$ reward" on some programmer for hire board. This should include the script and clear instructions on how to use it on your OS (I'm assuming Windows)

You can probably get it for 5$ or so but I'm assuming 5/10 is not a huge difference for you so just go with a sum that'll get you a good result guaranteed.
** 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 **
03-14-2013 , 09:54 AM
Quote:
Originally Posted by daveT
I guess it's possible that it is already saving the sorted function and returning the prefab faster. There's just no way that I'd be able to check for certain though, is there?
Code:
def insertionSort(ul = [23, 65, 1, 2, 3, 4, 5, 6 , 4, 109, 43, 9]):
    print(ul)
    for j in range(len(ul)):
        key = ul[j]
        i = j - 1
        while i >= 0 and ul[i] > key:
            ul[i + 1] = ul[i]
            i -= 1
        ul[i + 1] = key
    return ul

insertionSort()
insertionSort()
insertionSort()
output:
Code:
[23, 65, 1, 2, 3, 4, 5, 6, 4, 109, 43, 9]
[1, 2, 3, 4, 4, 5, 6, 9, 23, 43, 65, 109]
[1, 2, 3, 4, 4, 5, 6, 9, 23, 43, 65, 109]
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
03-14-2013 , 10:37 AM
Wow, this seems totally broken to me.

Code:
class A:
    def __init__(self, a): 
        self.a = a 

def foo(o=A(3)):
    print o.a 
    o.a = 4 
    print o.a 

foo()
foo()

Code:
3
4
4
4
Edit: Guess I should have read the stackoverflow link first.

I need to think about what the guy is saying in the stackoverflow link but it still seems like a poor design decision. Just because you can justify something with a high level explanation doesn't mean that its the right thing to do.

Last edited by jjshabado; 03-14-2013 at 10:42 AM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
03-14-2013 , 11:29 AM
The decision strikes me as elegant from the perspective of the language implementer, but really hairy from the perspective of the language user.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
03-14-2013 , 11:36 AM
ok, this is the hardest I've laughed at xkcd in years:

** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
03-14-2013 , 11:45 AM
Lol just had Jehova's witnesses (I think) at my door. Nice pitch...
"There's a new pope, we'd like to inform you about alternatives"
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
03-14-2013 , 11:47 AM
Quote:
Originally Posted by jjshabado
Wow, this seems totally broken to me.

Code:
class A:
    def __init__(self, a): 
        self.a = a 

def foo(o=A(3)):
    print o.a 
    o.a = 4 
    print o.a 

foo()
foo()

Code:
3
4
4
4
Edit: Guess I should have read the stackoverflow link first.

I need to think about what the guy is saying in the stackoverflow link but it still seems like a poor design decision. Just because you can justify something with a high level explanation doesn't mean that its the right thing to do.
Quote:
Originally Posted by Neil S
The decision strikes me as elegant from the perspective of the language implementer, but really hairy from the perspective of the language user.
What's the alternative though? Only allow pure constants as default arguments? Evaluating at function invocation is also going to surprise people under a different set of circumstances.

The design flaw to me is that python encourages use of mutable data structures.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
03-14-2013 , 11:49 AM
Looooool PanicSort is gold...//portability...hahaha
Edit: other 3 also good, loved the jobinterview one heh
Edit2: I've seen code similar to the bogosort return even with an extra commit with a message along the lines of "fixed typo, looks like real system error message now"
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
03-14-2013 , 12:12 PM
Quote:
Originally Posted by candybar
Evaluating at function invocation is also going to surprise people under a different set of circumstances.
Which set of circumstances? I can't think of any off the top of my head.

Very well said Neil.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
03-14-2013 , 12:21 PM
Quote:
Originally Posted by candybar
The design flaw to me is that python encourages use of mutable data structures.
'(lol wp)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
03-14-2013 , 01:28 PM
Just seems to me that invoking a function with a default argument of [1,2,3] passed with no arguments, should behave the same as if I invoke with an argument of [1,2,3].

To me it's not about problems, or when things should be instantiated, or magical scope issues. It's about a default argument working the same as an explicitly passed argument.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
03-14-2013 , 02:54 PM
Not the same language, but I don't give a parameter a name in the definition if I'm not going to use it. Avoids an unreferenced parameter warning. Something can belong in the interface but not be used in the implementation.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
03-14-2013 , 03:22 PM
Quote:
Originally Posted by Neil S
Just seems to me that invoking a function with a default argument of [1,2,3] passed with no arguments, should behave the same as if I invoke with an argument of [1,2,3]
obviously
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
03-14-2013 , 04:08 PM
They day I can read this forum and understand even half of what you guys are talking about is going to be sick.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
03-14-2013 , 05:50 PM
@TheMetetrown
Since you seem to be serious about getting into this, pick up a copy of "The Pragmatic Programmer" and read it on the side.
[in before a billion similar books are recommended but I think this is the most solid read on the side if you want to get into programming kind of book]
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
03-14-2013 , 06:36 PM
The pragmatic programmer was one of the few computer related books I read. I actually have every tip written on paper on my desk on a piece of paper. I glance over it from time to time.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
03-14-2013 , 06:45 PM
You're missing out on a lot of great books then
Lol-books is way overused for IT related topics imo

(also if your time is worth anything they are +EV because you don't have to search for stuff and they are generally good collections of certain domains)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
03-14-2013 , 09:15 PM
Quote:
Originally Posted by clowntable
My real question is...if JVM why not just stick with Clojure
If I was interested in being the sole maintainer + new-stuff dude for life, I'd do it in Clojure, but I'd rather they hire some freshy -- or someone who may have taking one programming class in college (or, heck, did some codeacademy stuff) -- and let the company deal with the new stuff themselves.

Quote:
Originally Posted by clowntable
Lol just had Jehova's witnesses (I think) at my door. Nice pitch...
"There's a new pope, we'd like to inform you about alternatives"
Love it!

Quote:
Originally Posted by tyler_cracker
'(lol wp)
>> (eval '(lol wp))
's/\[([AKQJT2-9]{1}[HDSChdsc]{1}),([AKQJT2-9]{1}[HDSChdsc]{1}),([AKQJT2-9]{1}[HDSChdsc]{1})\]/\[\1, \2, \3\]/g'

???
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
03-14-2013 , 09:22 PM
It's not a terrible thing. I can do streaming and lazy evaluation:

Code:
def streamOfBaseTwos(listOfBaseTwos = [1]):
    listOfBaseTwos +=[listOfBaseTwos[-1] + listOfBaseTwos[-1]]
    return listOfBaseTwos
 
print(streamOfBaseTwos())
print(streamOfBaseTwos())
print(streamOfBaseTwos())
print(streamOfBaseTwos())
print(streamOfBaseTwos())
print(streamOfBaseTwos())
print(streamOfBaseTwos())
print(streamOfBaseTwos())
print(streamOfBaseTwos())
print(streamOfBaseTwos())
print(streamOfBaseTwos())
print(streamOfBaseTwos())
print(streamOfBaseTwos())
print(streamOfBaseTwos())

for i in range(10):
    n = streamOfBaseTwos()
    print('2^' + str(i) + '=' + str(n[-1]))
Code:
>>> [1, 2]
[1, 2, 4]
[1, 2, 4, 8]
[1, 2, 4, 8, 16]
[1, 2, 4, 8, 16, 32]
[1, 2, 4, 8, 16, 32, 64]
[1, 2, 4, 8, 16, 32, 64, 128]
[1, 2, 4, 8, 16, 32, 64, 128, 256]
[1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]
[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096]
[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192]
[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384]
2^0=32768
2^1=65536
2^2=131072
2^3=262144
2^4=524288
2^5=1048576
2^6=2097152
2^7=4194304
2^8=8388608
2^9=16777216
>>>
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
03-14-2013 , 09:33 PM
DaveT - that code is a terrible thing.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
03-14-2013 , 10:15 PM
Guido is not a fan of Lisp, not a fun of functional programming, thus I suspect he's not a fan of the list data type, which is why it sometimes feels like a huge middle finger when you get too fancy with lists in Python.

TheMetetrown: JJ is correct, that code I posted is a terrible thing.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
03-14-2013 , 10:37 PM
dave,

i think there's something wrong with your repl; it got sed all over my nice functional side-effectless program!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
03-14-2013 , 10:56 PM
i was in a meeting today at work about our mail systems. one of the reports we looked at showed delivery failures. mostly it was stuff like hotmai.com and verion.com -- places where people typo'd while trying to enter an address. my boss was interested in the top entry:

boss: "what's homail.com?"
me: "it's where your mom checks her email."
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
03-14-2013 , 11:10 PM
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
03-14-2013 , 11:28 PM
Speaking of Python wat, here is something I just discovered today:

Code:
# assume L is a list both times

def f1(L):
    L += [1]

def f2(L):
    L = L + [1]
They don't do the same thing. Even Guido thinks this is horrible.

Re: the mutable defaults thing, I've been using Python for awhile and I've actually been bitten by that bug zero times, and written code that depended on that behavior, but I'm inclined to agree with Neil in principle and regard it as "probably a necessary evil." I don't really know how you would fix it without copy.deepcopying the defaults dict every time the function is called, especially when you consider the possibility of nested mutable structures.

Re: why the other way could ever be a gotcha, here's an example stolen from the SO post:

Code:
bread = (1,2,3)

def toast(food = bread):
    # do things

# bunch of other code

bread = (8, 6, 7, 5, 3, 0, 9)

# a lot of other code

toast()
daveT: I don't understand why it follows that hates FP = hates python lists. Wouldn't FP types like tuples better anyway since they have essentially every property of lists except side effects?
** 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