« first day (3261 days earlier)      last day (1678 days later) » 

1:50 AM
The OP does not seem to be aware about the difference between a list and dictionary.
 
 
1 hour later…
4:05 AM
@roganjosh @AndrasDeak @ParitoshSingh sorry for late response and thanks for chipping in :) Yes, server is an option which we thought of but we are exploring cheaper options. the clients have zero tech background. The ideal way is dropbox which we are doing now. They drop files, and i transform and give it back to them. However, imaging that they have same file structures and same transformations which they would expect to run every month . The output would be used for some quick analysis.
I was thinking if we can explore something like a browser where they would upload the files, and run the relevant script.
they wouldnot have to come back to us every month. There would be filters on the file based on what type of cleansing or transformation they want to achieve so I cannot automate this process.
And yes the file size are big for emails to handle :)
 
@anky_91 something like repl.it ?
 
@αԋɱҽԃαмєяιcαη Thanks, checking that now :)
 
 
1 hour later…
5:20 AM
Hi People.
 
6:05 AM
cbg
 
pcalcao
bpaste.net/show/XYX- after using anticaptcha paid service. i still having an issue to solve the captcha. how can i edit my code to solve the captcha during the login session
 
6:30 AM
@αԋɱҽԃαмєяιcαη a captcha usually means they don't want you to edit your code to solve that
 
@AndrasDeak I do understand that point. the target is i need to automate my code for weekly schedule instead of doing this manually each time.
even so :) I'm not looking to crack it or spam purpose as i already having an account there :D
 
Okay
 
do you also get a CAPTCHA when you do the thing manually? does the site offer an API for registered users?
 
um, "cabbage" i guess
haven't spoken here before
 
cbg
@tripleee Yes, they taking CAPTCHA when login manually via browser. and they don't offer API for registered users.
 
6:44 AM
@ZaeZoxol cbg
 
what was it you were trying to automate with the anticaptcha?
 
@AndrasDeak So that's why I didn't sleep well tonight!
 
@ZaeZoxol trying to login with anti-captcha during same session to not solve different CAPTCHA
 
...i cant read those captchas either
 
anticaptcha can :D
 
6:53 AM
its like...all lines
ah, maintaining a login, not creating a new one
 
a day will come when captchas can only be solved by computers
 
Mini-riddle: find the bug
def has_length(obj):
    cls = type(obj)
    return hasattr(cls, '__len__')
 
wait, why would the class have the length?
 
you might be on to something there... maybe
 
class attributes are weird
Class.mro exists even if Class().mro doesn't
 
6:58 AM
now you're definitely on to something
 
wait what?
is this not a bug that'll be visible with built-in types?
 
nope, you'll have to write your own obj
 
ohh ok
 
there are multiple ways of doing it, so bonus points for finding them all
(Disclaimer: all points are imaginary)
 
@ZaeZoxol correct.
 
7:06 AM
Well, I should add that all solutions have something important in common, and only vary in somewhat minor details
 
argg length lookup is on the class too
wait...its the inverse of what im trying, isnt it?
 
I'm not sure what it is that you're trying :p
 
im trying to get the return value of that function and whether len(x) errors to mismatch; either True but its False or False but its True
but if i define __len__ on an object and not on its class, it refuses to length
 
you're close, but you need to define __len__ somewhere else
 
ohh it was mro that made you say i was onto it; time for Pointless Data Relations
...this isnt about getattr is it??
 
7:18 AM
not... really. It's part of one of the possible solutions, but it's not the key thing
 
@Aran-Fey of course!
Putting it that way makes it obvious, at least I think :D
On mobile now
 
...how do i declare the meta-class of a class again?
 
class Class(metaclass=Meta):
 
huh, googling the answer did not bring me back to SO
ah, there it is
class M(type):
    def __getattribute__(self,attr):
        if attr=='__len__':return lambda self:42
        raise AttributeError
class E(metaclass=M):pass
e=E()
has_len(e) #=> True
len(e) #=> TypeError
the object's class theoretically has the attribute, but because it doesnt actually, it cant be inherited
was that it?
 
7:46 AM
yep, that's it
though the __getattribute__ isn't necessary (you can define __len__ in the metaclass and it'll still not work)
And just in case anyone thought "Well, that bug is super unlikely to be triggered in real-world code", think again:
class Class(enum.Enum):
    A = 1

obj = Class.A
 
8:05 AM
hmm, another thing i missed in trying to make a class whose instances were every kind of object
they could be added, moduloed, indexed, called, attribute-lookup'd, and converted to int
in that order, without raising any kind of err
but i suspect they dont support subclassing
 
8:17 AM
erm, seeing how you don't know how special methods in Python work but still are inquiring about metaclasses -- what are you trying to do?
 
How can a class not support subclassing?
...other than using a metaclass that explicitly forbids it, I suppose
 
no, the instances didnt support subclassing
one of my novelty projects is a class whose instances support every operation possible, and return self where possible to allow chaining
i worked out a subclass metaclass of my class that can be subclassed as well
 
8:42 AM
metaclass instances supporting subclassing and so on is actually the default
only ground types are a degenerate case that do not
either way, "subclassing" and "instantiation" mean very little in Python strictly speaking -- it's just what the default type and object pretend to do by convention
 
...i understand those things
the class i'd defined that supports most operations wasnt a metaclass, so its instances were not classes, and therefore did not support subclassing
 
9:01 AM
now the class inherits from type and its __new__ returns a subclass of itself
and because its instances are also subclasses of itself, its instances are metaclasses as well as classes, as well as instances that support numeric operations/container operations/etc
you could redefine the class using one of its instances as the metaclass
 
9:29 AM
cbg
 
9:48 AM
I've got another one: Guess the output
class Class:
    a = 'class'

    @property
    def b(self):
        return 'class'

    @property
    def c(self):
        return 'class'
    @c.setter
    def c(self, c):
        pass

    def d(self):
        return 'class'

instance = Class()
vars(instance).update({
    'a': 'instance',
    'b': 'instance',
    'c': 'instance',
    'd': lambda: 'instance'
})

print(instance.a)
print(instance.b)
print(instance.c)
print(instance.d())
 
am I the only one ticked off by class Class? :D
 
it's very self-documenting, so I don't see the problem ;P
 
so classy
 
It looks cool :)
 
10:06 AM
I gotta run, but it's up on the riddles page if anyone's interested in the solution/explanation
 
I don't think I've seen that page yet, what a nice addition. And thanks to the content providers
 
10:18 AM
Does anybody else hate Restructured Text linking, or is this just another of my personal aversions? Been struggling for an hour just to create a couple of links between two docs in a set. Getting bored.
 
Does anybody has an opinion about how to calculate matrix distances in python
 
Please clarify what you mean by "matrix distances"
 
@holdenweb ReST was nice at the time but I think Markdown already won that competition and it's just a matter of time until the remaining pockets of resistance understand what they are doing wrong
 
I want to find the similarity between 2 matrices. I tried EMD but it isn't work
 
googling is slightly challenging because even with quoting you get a lot of matches for "distance matrix". But googling for "matrix distance" -"distance matrix" python gets me what looks like good hits, including e.g. stackoverflow.com/questions/34001052/…
(not a particularly stellar reference because it doesn't have any answers, but you probably know more than me about the actual subject so try googling)
 
10:38 AM
thanks @tripleee
 
10:55 AM
@holdenweb I hate the entirety of ResT, does that count?
 
In my book, yes. The issue with Markdown is it doesn't yet have ReST's rich interlinking capability. If it did I'd be happily using it, but my client has the docs in ReST and won't be inclined to fund the translation, I suspect.
 
rbrb
 
11:15 AM
I'm looking at behave as a way for spec'ing out my integration tests (I'm referring to the day job now, now pyparsing). I'm trying to anticipate what kind of proliferation of .feature files there will be, and then compare that to the current proliferation of massive .py files that we run now.
 
11:33 AM
@tripleee o7 pocket of resistance, checking in
 
we forgive thee, for though understandst not etc
 
For Readmes and the like I use markdown because it's better for single, coherent documents. But If I'm writing documentation there is no way md has a chance because it's not supposed to be fleixbily combinable
Oh, I even found the article that made me understand their respective differences back when I was still undecided zverovich.net/2016/06/16/rst-vs-markdown.html
though maybe it's nitpicky and md is just better, I don't know. I guess I just got used to RST by now
 
11:54 AM
I tried to write my Master's thesis in ReST but in the end I had to import to Libre Office to fix it up
I have not tried to write anything of comparable complexity in Markdown but a couple of articles in Pandoc was a breeze and much more natural
fewer struggles with the markup and it supported everything I needed
granted, if you want to publish a lot of mathematical equations, that might tip the balance
Pandoc adds support for tables and footnotes, withoug which Markdown is definitely too spare
 
hmm, I'd say if you want to write a document that is meant to be read from top to bottom then markdown is simpler, better, and easier to use. if you write something that has an index and is more like a tree, so you'll end up with a bunch of directories whose files might refer to or contain parts of each other, then rst is simpler, better, and still a bit of a pain to use.
 
12:22 PM
cbg
(Lazy and sleepy fingers)
 
@tripleee In Markdown's favour as far as I'm concerned, MathJax integration being a very useful tool sometimes.
I'm with Arne here - Markdown just isn't up to the task of handling complex sets of inter-referenced documents, and it wasn't designed for that. ReST was.
 
12:53 PM
@holdenweb I'm used to bothering with LaTeX, ReST is a joy in comparison
Markdown is nice if it is meant primarily for humans, but as a specification for a machine ReST is just so much more pwoerful
 
1:28 PM
Do Markdown editors help alleviate this pain? Looking at doing some self-publishing, and was gravitating to MD
 
@tripleee that's what latex is for :P
 
1:53 PM
I saw a reference to FizzBuzz last night and decided to remind myself of the problem and its constraints. We would all agree that the explicit, wet version of a solution is fine and any attempt to reduce character counts (as in encouraged on things like Hacker Rank) is fun but not what someone who is hiring a developer would want to see, right?
Good:
for i in range(1, 16):
    if (i % 3 == 0) and (i % 5 == 0):
        print("FizzBuzz")
    elif (i % 3 == 0):
        print("Fizz")
    elif (i % 5 == 0):
        print("Buzz")
    else:
        print(i)
Bad:
for i in range(1,16):
    if i % 3 == 0:
        a = "Fizz"
        if i % 5 == 0:
            a="FizzBuzz"
    elif i % 5 == 0:
            a="Buzz"
    else:
        a=i
    print(a)
Am I correct in my assessment on this would you say?
 
@AndrasDeak I tried really hard to like LaTeX but every time I tried to use it, I had to scream and cry and squirm over how it was practically impossible to separate content from presentation. Maybe that has finally changed, though?
 
the second one isn't even shorter
 
It is by a few characters
 
the last time I fiddled with fizz buzz, the flat if/elif chain was also by far the fastest
@Dodge including whitespace?
 
@MisterMiyagi That is good to know. No I did not count whitespace
 
1:58 PM
but I get the feeling that even if there is a subset of LaTeX that allows for modular documentation which can be reused and recombined in different ways, the community and the culture will not understand it or want it
 
I think the point of FIzzBuzz is to illustrate that sometimes it is okay for code to be WET and if I'm ever faced with this in a situation where it matters I'm going to offer the "good" solution, unless there is something about this that I am missing. I read that this is still a popular question for programming interviews, which is why I mention this
 
AFAIK it is basically used to quickly filter out bad apples. The focus isn't to see if you have a clever solution, but if you are able to code at all.
at least for Python, practically all optimisations I have seen for it fail horribly.
hint: dict as a dispatch table is slooooooooow
 
@MisterMiyagi Cool, thank you for the feedback, I have zero perspective on any of this from an industry standpoint
 
morning cabbages all
 
2:38 PM
evening cbg from central europe =)
 
2:49 PM
oh cool! What's the weather like, there?
 
how to maintain session during solving CAPTCHA
 
Cool in the mornings, warm in the afternoons. Beautiful weather for shutting the windows and writing code.
 
@Arne agreed
 
Any weather is beautiful if you shut the windows
 
3:19 PM
@tripleee nothing changes. The idea is that you leave typography to the interpreter. Assuming I understand your issue.
 
-1
Q: Python requests to solve CAPTCHA during login

Anna PlymI'm trying to login for this particular site. upon inspecting element for the Form data i do see that the website asking for the following. ghsdfkjlksssalk35bbr # generating base64 value upon login if I'm correct SellersLoginForm[username] # that's will be for username SellersLoginForm...

 
@αԋɱҽԃαмєяιcαη what about it?
 
@AndrasDeak login to website with CAPTCHA resolver paid service.
 
@αԋɱҽԃαмєяιcαη please restrict SO questions to a single, well-defined issue
 
@MisterMiyagi the question is well defined. it's about maintain session during solve CAPTCHA.
 
3:34 PM
it may be about that, but it already contains three sub-questions at the top, some of which are obsolete by the end of the question itself
 
@MisterMiyagi did you noticed the part of UPDATE
 
on a side-note, I find it seriously questionable to ask how to circumvent Captchas
@αԋɱҽԃαмєяιcαη yes, that's why I wrote "some of which are obsolete by the end of the question itself"
 
@MisterMiyagi who said it's circumvent . CAPTCHA is created by human to deny spam or cracking methods ! Here am a real human which want to login to the website automatically on schedule. in order to retrieve data on my account.
 
@αԋɱҽԃαмєяιcαη but you aren't logging in, you are writing a program to log in for you.
 
@Code-Apprentice do not you think it's better to write a code to did this task on schedule ?
 
3:48 PM
I think that circumventing CAPTCHA is questionable.
 
WHY NOT THEN, whatever
 
@αԋɱҽԃαмєяιcαη is that your question?
 
Nope, my question is how to maintain session while solving captcha and login .
 
OK, just checking
 
@AndrasDeak thanks
 
4:50 PM
poll question: how my bytes is your typical environment directory taking up?
 
you mean venv's and the like?
 
yes
I use anaconda and I've got one that is 3.5 gigs
 
Whew, that's one eight hour training course down for the year.
 
I'm building some conda packages where I'm clearly wrong about something because a very small library is taking up way too much space
 
By cleverly not reading any of the slides, I finished in five B-)
 
4:54 PM
@Kevin so 5 hours just to satisfy the artificial time gating?
 
This is actually the first one I've taken in a while that did not read each slide out loud and only enable the "next" button after it's done. It's the tests that were time consuming.
Or perhaps it's more correct to say that looking at the first question, grumbling "ok, I guess I should read the slides a little", and going back to look at the slides is what took up my time.
Turns out, if you don't already know what they do, it's hard to identify the difference between WPA and WPA2 just based on their acronyms
 
5:12 PM
Kevin'd again. Do we get handicap seconds for being on a phone and on a train with limited connectivity?
 
The train enters a tunnel, and the car goes dark. A woman screams. When light is restored, the question is lying on the ground, brutally answered.
6
 
    In this method,

    def convert(data):
        new_data = []
        for id_users in range(1, nb_users + 1):
            id_movies = data[:,1][data[:,0] == id_users]
            id_ratings = data[:,2][data[:,0] == id_users]
            ratings = np.zeros(nb_movies)
            ratings[id_movies - 1] = id_ratings
            new_data.append(list(ratings))
        return new_data

I don't understand this line

            ratings[id_movies - 1] = id_ratings
 
Confession: I have no idea what "high precedence" and "low precedence" actually mean, and I operate purely on instinct when verifying that long expressions work
 
@Kevin it's not gonna be a blockbuster.
 
When is Hollywood going to bring back the Train Drama genre?
(Snowpiercer doesn't count)
 
5:19 PM
I'm not sure if writing code like id_movies = data[:,1][data[:,0] == id_users] without any sort of comment is criminal or if I just don't know numpy well nough
 
Probably never. The train will obviously contain an expert in such cases.
 
no just doing a tutorial on machine learning, its not my code
 
ah, machine learning. In that case I'm inclined to believe that the code is indeed terrible
 
When a tutorial contains uncommented unexplained bad code, find a new tutorial
 
Baddies will burst into the carriage but will ultimately stand no chance. Not only is the protagonist a krav maga professional but they knew ancient Mayan texts that foresaw it all. Then you can leave the cinema.
 
5:23 PM
@erotavlas But the line in question simply looks like someone is reconciling something that is not zero indexed with something that is
 
I asked an R question!
 
That's allowed
 
only because I'm trying to reimplement some R code in Python
 
ok so id_movies = data[:,1][data[:,0] == id_users] is all the movies that were watched by the particular user in the loop (id_users) - so the entire column where users column == id_users and the same thing for id_movies
ugh nevermind, without you guys seeing the data its not useful
 
I feel like iterating over all users and for each user saying "now find the matching id in this other table" is not the most efficient way to join two tables
 
5:26 PM
This is why ML does not fit neatly into SO, there is always so much context required for any sort of Q&A
 
that's true, I think I'll switch to pycharm so I can step through
using spyder right now
 
5:38 PM
I don't understand what's missing in this when using Spyder vs pycharm?
 
i wasn't able to place breakpoints in spyder, is it possible?

ok so maybe its not so bad, my earlier question relates to this line

ratings[id_movies - 1] = id_ratings

if id_movies is a list of integers what is [id_movies -1], this is what doesn't make sense to me.
 
How do we deal with this kind of "I wrote code to do X but it's not working" question? Do we fix the code or do we mark as dupe of any other "how do I do X?" question or both or something else?
 
@roganjosh I got it, I can step through the code in spyder now, you have to explicitly start Debug mode from the menu to do it
 
I'd be inclined to write an answer explaining why the code is broken, and say something like "... But actually, you don't need to do any of this, since you can convert hex to binary [this way]"
That's what I was going to do before two people pointed out "just pad the numbers" which took half the wind out of my sails. I could write an answer saying "actually, you don't need to pad each byte individually in a loop, since bin and hex accept strings and integers of arbitrary size", but meh
 
How horrible would it be to hammer the question as dupe and explain the problem with the code in comments?
Because I find "what's wrong with my code" kind of questions utterly useless (so I'm inclined to interpret them as "how can I do X" instead)
 
5:48 PM
@erotavlas I don't think id_movies is a list but an np array, otherwise you have a syntax error. I think the problem is that id_movies starts at one not zero, so you need to subtract one to assign to the np array with the id
>>> a = np.arange(10)
>>> b = np.arange(1,4)
>>> b-1
array([0, 1, 2])
>>> a[b-1] = 42
>>> a
array([42, 42, 42,  3,  4,  5,  6,  7,  8,  9])
 
At this point I think it would be OK to hammer. OP already got an answer suggesting fixes for his specific approach, so he's unlikely to be inconvenienced if the question gets closed now.
 
*swings hammer*
 
@Dodge when I step through I can see this line on the first pass of the for loop

ratings[id_movies - 1] = id_ratings

is dumping the list of ratings into the ratings list, but how does it know 'where' to place them?
 
<I add another quarter to the "posted a comment that maybe should have been an answer" jar>
Meh, I just didn't feel like being accountable for some corner case I hadn't considered
 
@erotavlas indexing?
 
5:52 PM
i mean this ratings[id_movies - 1] doesn't make sense to me if id_movies is an array
index to me is a single integer, not an entire array
 
you can use an array to index multiple items with numpy
 
np arrays have some interesting magic
>>> np.array([23,42,99])-1
array([22, 41, 98])
 
ah
 
In my example I have shown this neatness
 
i had a feeling it was some kind of python voodo but i guess its numpy specific
 
5:54 PM
TIL the difference between str.rjust and str.zfill
 
>>> x = np.array([4, 8, 15, 16, 23, 42])
>>> y = np.array([2, 4, 5])
>>> x[y]
array([15, 23, 42])
>>> x[y-1]
array([ 8, 16, 23])
I don't know if this is useful or surprising to anyone else, but it's a good refresher for me
 
>>> '-1.2'.rjust(5, '0')
'0-1.2'
>>> '-1.2'.zfill(5)
'-01.2'
 
@Aran-Fey What in tarnation
 
zfill is specifically for numbers. It inserts the padding after a leading sign, if one exists. That's why the fillchar is fixed at "0", too.
 
@Dodge Ah, so you have.
 
5:57 PM
@Dodge yes thank you
 
argh, I could've turned it into a riddle and made a new personal best of 3 riddles in a single day, what a wasted opportunity :(
 
@erotavlas happy to help
 
Hmm, the volume control icon in my task bar vanished the last time my computer bluescreened and now I can't tell whether my speakers are muted or not
I can still change the volume settings by accessing the Dell Audio window, but it's two menus deep, so it may as well be in Siberia for all the good it does me
 
@erotavlas I can honestly say I've never used it. I just run the program and let it fail... Then access everything that succeeded
 
I do that too, but I'm finding debug mode a big help, I can see variables inside functions in the variable explorer as I step through, it wouldn't show those before.
 
6:11 PM
As far as my understanding of breakpoints goes, there is just no need in Spyder. Everything is in memory after a script failure. Maybe I'm just a caveman when it comes to debugging
Ah ok. Yeah, they won't be saved, I tend to use print but I guess the debugger is more elegant
 
I found the menu that re-enables the volume icon, but my computer bluescreened before I could do anything.
Naturally, my first thought is "I wonder if that happens every time?" so if I go quiet for another twenty minutes, you'll know why
 
6:36 PM
Hmm, this website that recommends uninstalling and reinstalling my sound drivers doesn't give much guidance about what to do when uninstallation succeeds and then there's no button for reinstalling. I guess I just don't have sound now.
Sound icon is back, now it says "No Audio Output Device is installed". At least it's back in touch with reality 👍
 
you'll just have to work with no sound
 
Oh, I can work with no sound easily. It's goofing off that gets harder.
How am I going to watch Vines like this
 
i'm listening to music on spotify right now
 
;_;
A "Device setup" window has appeared, and I'm optimistic that it's trying to install the audio driver. Slightly unnerving that it's doing so with no permission from me, but ok.
 
what kind of dell do you have?
 
6:52 PM
Success
 
"Your code could not be one-lined. Open problem: yield" :-(
 
Hey all, I am a C# developer who is trying to learn python so I'm a beginner. Could someone please tell me if it's recommend proper good practice to always use the var keyword whenever we want to assign a value to a new variable? (In other words, is plain assignment poor practice? )
:) corny pun: "to var or Not to var"
 
As in, var x = 23? That's not actually valid Python syntax. Are you thinking of javascript?
 
oh
 
7:21 PM
But this question does remind me of a design choice that I often see from C++ expats, which I don't care much for. It goes like:
def f():
    x = int
    #do some stuff...
    x = 23
    #do some more stuff...
Basically they're trying to port over the "type declaration" syntax from their home language. But we don't really do that here. It's OK to assign to a variable name in the middle of your code without making its type obvious earlier on
Ideally the reader should be able to deduce the type from the variable's name and the way it is used
 
def f():
x = int
#do some stuff...
x = 23
#do some more stuff...
x = "Crazy Developer"

Will the aforementioned code throw an error? Or Is it poor practice to do the aforementioned type of coding?
 
If you corrected the indentation, that code will run with no errors. All three assignment statements are perfectly valid, and Python does not care that x gets bound to objects of differing types throughout its lifetime
I don't know if I'd call it "poor practice" to reassign a variable to an object with a different type. I do try to avoid it, since I think it makes it harder for the reader to make inferences about the behavior of my program. But it's handy in rare cases.
 
I'm on my final train and two guys have just got on speaking really loudly. From what I gather, they've just been pitching a perpetual motion machine but they forgot to mention their "micro-molar free radicals". But the guy has just finished his PhD apparently, so all is good.
It's like some painful comedy sketch. 10 more minutes, 10 more minutes...
 
So they believe in their device and aren't just scamming?
 
7:39 PM
My perpetual motion machine works, or will work rather, based on what I call Kevin's Uncertainty Principle. The principle is: you can't prove that the laws of physics won't be totally different tomorrow. Maybe the little turbine I've got here will just start pumping out free negentropy from nowhere.
Just because it's never happened, doesn't mean it can't happen. Grant money please.
 
when calling `Python code.py` am expecting the output to be `watch -n 0 code.py` . I already linked code.py to /usr/local/bin

import urllib.request
import json
import os

cmd = 'watch -n 0 code.py'
os.system(cmd)

with urllib.request.urlopen("https://api.binance.com/api/v1/ticker/price?symbol=BTCUSDT") as url:
data = json.loads(url.read().decode())
b = data['price']

print("BTC Price:", round(float(b), 2), '\n') # will print BTC Price.
print(format(round(float(b) * 1.5, 2), ',')) # will print BTC PRICE * 1.5 For example.
 
Wait, so your code.py program executes watch on code.py? Won't that cause a fork bomb or something?
If you want to do something repeatedly, I recommend a while loop
 
@Kevin Since I have a C#/Java programming background, I'm just more accustomed to more "static typing", therefore, I find it "uncomfortable" when we can just reassign a variable to an object with a different type. It seems that Python leans toward dynamic typing
 
That's fine. I think you can get by perfectly well by having only one type per variable.
Even the "rare cases" I was thinking of are more akin to regular old polymorphism than truly dynamic typing
 
@holdenweb I couldn't work out what it was properly. It was just an amalgamation of technical-sounding phrases that didn't amount to anything but it seemed they had pitched something. The fact that they spoke so obnoxiously loud for me to hear most of the conversation from the other end of the carriage made it like some panto playing out
 
7:46 PM
But could I at the very least "mark" off the type of a variable by naming the variable in such a way that the type is mentioned in the variable name? To elaborate, yearInt, wagesFloat, firstNameString
?
would that be good proper practice( or at least acceptable naming convention practice)?
 
@Kevin When I was working on a production line, I solved the perpetual motion issue multiple times in my head. The trick is to increase the recursion limit on magnet interactions
 
@crazyTech That's not a very typical style. If you're really keen on explicit typing, look into "type annotations"
 
@roganjosh They were probably just hyper. Presentations can do that to people.
 
Incidentally I can't recommend using a float to store wages, since floating point numbers can't represent all values with two decimal places with perfect precision
For example, 0.01 is actually stored as 0.01000000000000000020816681711721685132943093776702880859375 in memory. Most of the time those extra digits are invisible and unnoticed, but every once in a blue moon the errors bubble up...
 
To 1 pence/cent out?
 
7:52 PM
@Kevin so what type should be used for wages with decimal points?
 
Storing money as an integer number of cents is one popular approach. The decimal module is another.
 
@holdenweb possibly. They certainly weren't academics, I have spent enough time in Uni to get a grasp of how they speak, this was just disparate words. Oh well, I'm back home now and free from it :)
 
:-)
 
@Kevin ok Thanks
 
@roganjosh To learn more about the dire consequences of being off by a penny, consult Mike Judge's 1999 documentary Office Space
@crazyTech also check out PEP 8 for a comprehensive look at standard Python style
At the very least, use year_int instead of yearInt ;-)
 
7:57 PM
@Kevin I haven't seen it, but it does look like there's lot of invaluable insights to be had. I shall add it to my list :)
 
@Kevin The very first freelance job I undertook was converting an accounting system to multi-currency. Large invoices, particularly those in Japanese yen, were prone to be one unit out in the least significant digit due to accumulated rounding errors. When I asked, in my ignorance, whether this was a real problem the accountant's face was a picture.
 
Mona Lisa, or The Scream?
 
mmm, I guess I have exposed a real naivety
 
One yen is worth about a penny, give or take 10%. So even programs that deal exclusively with American dollars and cents would do well to guard against floating point imprecision.
 
@Kevin Happy to say that stuff is now no longer included under "material I teach". but I used to teach a wireless security class and once upon a time could have explained the difference. The best I could do now is "WPA2 ensure automatic session re-keying," but even that's probably wrong. IIRC WPA is hackable due to shared keys, whereas WPA2 uses dynamically generated keys?
 
8:04 PM
WPA2 is like WPA, but it's one larger
 
@Kevin Now tell me what the exchange rates were in 1976 ...
 
Accessing my incredibly vague knowledge of world history... That was before Japan's economic boom, right? So I'm going to guess a yen was worth less back then
 
@Kevin That was going to be my first answer, but I figured the low-hanging fruit would already have been picked.
@Kevin IIRC it was in the region of 150 yen per pound.
 
Let's see... The 1970s was the end of the "high increasing stage", whatever that means. It sounds like a good thing I wager
 
The two orders of magnitude made quite a difference on large orders (these were companies buying biscuits, BTW - the client was Fox's Biscuits in Batley, Yorkshire).
 
8:08 PM
This was also before 64 Bit, though?
I understand the accumulation of error, I'm not quite sure I see where 1/150 becomes a giant accounting factor unless there's thousands of huge transactions
 
I'm sure you could have floats of whatever size you wanted, if you were willing to forego any native math chip support and write up your own implementation
 
I guess it's gonna be one of those where I just have to write an off-by-1-cent program and horrify myself with the reality
 
en.wikipedia.org/wiki/Floating-point_arithmetic#History suggests that 72 bit floats were available as far back as the 60s, but (surprise surprise) support varied wildly and nobody could agree on a standard
 
@Kevin for some reasons. while causing I'm a teapot
 
@αԋɱҽԃαмєяιcαη I had a room invite from you this morning but I don't know why?
 
8:15 PM
@roganjosh Considerably before. I was working on PDP-11's, which were 16-bit machines with (later) a 20-bit (?) virtual address system. en.wikipedia.org/wiki/PDP-11
@roganjosh Each order line took an (inaccurately represented) price and multiplied it by the number of units. These totals were added over orders sometimes extending to several hundred lines (you'd be surprised how popular British biscuit are in Japan). Maybe my arithmetic was faulty.
All I do know is a) the answers were wrong, and b) I corrected it by applying a rounding algorithm to each intermediate result and the problem went away. This was only about eight or nine years into my programming career, so I didn't investigate the exact causes once the problem was solved.
 
I doubt your arithmetic was faulty, I can certainly see how that spirals badly under those cirumstances. My question to myself is whether I take 64 bit for granted in this kind of problem :)
 
Presumably the exchange rate was also slightly in error, so the accumulation of rounding errors isn't hard to understand.
IIRC RSTS/E BASIC PLUS used a 32-bit floating-point representation. 64 bits would have seemed like an insane waste of memory in a 64-KiB address space.
 
@erotavlas one-based indexing is a crime
@Aran-Fey it should be data[data[:,0] == id_users, 1] instead
 
<cough> MATLAB </cough>
 
@Dodge not a syntax error
@roganjosh I meant in 0-based languages
 
8:28 PM
:)
 
0-based indexing is a crime in MATLAB
 
@Kevin Was that a hyperbolic reply or a literal statement of truth?
 
8:44 PM
@holdenweb Reading your link about the PDP-11 gives me great appreciation for people that grew up through that era and the in-depth knowledge that using that stuff probably impart even today. It feels strange to me that, even though technology is probably on some kind of exponential growth curve, I don't think my programming environment has changed really at all in 5 years
Old phones are clunky, I struggle with them, but for the most part, the base of a laptop is pretty much the same.
I guess a lot of the "advancements" actually just spin off in consumerist directions. There can be massive clusters of CPUs but the access point stays pretty similar. We're not going towards sci-fi weird interfaces
... or are we, and I'm just under a rock here?
 
Closed
 
it's been put on holden
 
:-)
 
Thanks and I feel the need to apologise on behalf of Andras for that pun :P
 
@Kevin I guess now we know what x: int is for
It's like some toys you might give to toddlers who think that they need to hold on to something in order to be able to walk. Mechanic placebo.
 
9:02 PM
@roganjosh When I started there wasn't much to know, so it wasn't hard to know a lot of it.
Wherever you start, you accumulate knowledge in layers and there comes a time (a combination of reduced input processing rate and increasing volume of available input) when you start to lose the detail in the lower layers.
As long as you are confident in your assimilation of the layers above this loss is advantageous. You have a good standard library so many problems are easy to solve.
But there could come a time when the processing rate has declined to almost zero and new books are being published every femtosecond. Then I'll just drool into my beard.
Much as I do now, but more visibly.
 
Haha, but I definitely do get your point
 
And some of the detail you never lose, but it becomes increasingly irrelevant for anything other than serendipitous purposes - things that interest us tend to be those that trigger familiar hooks, so the detail you remember tends to add significance to some inputs.
 
Would you go so far as to say there's a coding device emerging that will overtake a laptop?
 
@Kevin That's a bit cautious. I write everything in /tmp, and if it doesn't get moved somewhere safer before the next reboot it was just an experiment.
@roganjosh That's an implementation detail. I worked for Sun when they introduced the marketing slogan "The network is the computer." While I hated it as a slogan it encapsulates very well the idea that information processing can be a plug-and-play experience.
 
I mean, I'm typing this on a wireless keyboard, and my laptop is plugged into a TV but the former is because it's just easier for me to not hunch, and the latter is because I got my ass kicked one night on Battle for Middle Earth, hastily put my laptop down and the mouse flicked up and obliterated the LCD
 
9:10 PM
The only reason we need laptops is because distributed computing is still in its infancy.
 
@Kevin it seems the troops have dwindled
> Nevada authorities say about 40 people gathered overnight at Area 51 with plans to storm the gates before leaving peacefully.
 
"storm the gates before leaving peacefully" sounds like the storming will be purely symbolic. They must be feeling pretty dumb.
 
No, the ones who would feel dumb didn't go there :D
I'm told there were millions who accepted the invitation for the event originally
 
I got the impression is was a device to freak the government rather than a device to rally troops to the physical location. But I haven't taken an interest.
 
I think it was just the internet being funny
 
9:21 PM
@roganjosh Pros get their equipment repaired ;-). Imagine a network where you just plug in your keyboard, mouse, display and authentication hardware (all but the last being possibly a part of the station) to get reliable computing. Once you remove the need for local processing, the possibilities are endless. Many more specialised interfaces can be provided.
 
@holdenweb Pros live with battle scars :P
But sure, I think those kind of access stations already exist? I'm pretty sure someone in here was talking about how their office used Raspberry Pis to connect to linux VMs that actually did the work
Not VMs... instances, I guess
But at the same time, I guess there is part of me becoming old. I'll be 32 in a few months but I really don't want to let go of the physical equipment. There's a reason I haven't repaired this laptop; it's like 6 years old. But it's mine and configured how I want it. I don't know if I could cope with everything being on some remote system tbh
 
@AndrasDeak TypeError, I stand corrected ;)
 
10:10 PM
@roganjosh I was installing diskless workstations for Sun in 1985, but they used a traditional SunOS. Chromebooks and the like would be ideal if we had a non-proprietary Internet, but that door has already closed.
and, of course, it would need to be two orders of magnitude more reliable.But that's only a matter of time.
OK, rhubarb all, bugrit. Time for bed.
 
My protest doesn't come with logic but rather something that is innate in me. I've been in a situation before trying to swap HDDs between PCs to salvage data. However crude that is vs. Images, it's still physically in my hand
Rbrb holdweb, I've enjoyed the chat :)
 
That's simply a reliability and access speed issue.
'Night!
 
Silly autocorrect. holdenweb, sorry :/
 
11:08 PM
Cabbage
 

« first day (3261 days earlier)      last day (1678 days later) »