« first day (1292 days earlier)      last day (3880 days later) » 

15:00
@user961627 I don't know unfortunately, you'd have to ask a statistician as it's beyond my experience. Do you have to use statsmodels though or could you use other libraries? I think scipy supports multivariate regression.
@InbarRose Ok, I voted as "can no longer reproduce" since the problem went away when the OP upgraded. Might be a bit overzealous (since he could still technically reproduce the problem if he downgraded), but I don't think the OP will mind, since he got his solution a month ago.
@Kevin I closed for the same reason.
no i don't need to use statsmodels... i have seen that scipy supports multivariate regression but i didn't find its support for weighted least squares...
or maybe i didn't look for it properly
@JonClements when I realloc() an array, will the result be at the same memory block? (I mean a single continuous block)
@Inbar not sure about closing - maybe prompt OP to self-answer and accept... albeit solved it's not that bad
Sab
Sab
15:02
Cbg everyone
heya @Sab
Sab
Sab
How's it :)
@JonClements User is very unlikely to return to the site.
In a perfect world, bvidal would have posted his comment as an answer, and gotten it accepted. I guess that could still happen since him and the OP are still active...
@user961627 you may be able to do it using docs.scipy.org/doc/scipy/reference/odr.html
Sab
Sab
15:03
@Ffisegydd Remember the thing I was trying to do yesterday?
@InbarRose user3438081 "last seen yesterday", according to his profile :-)
@Sab I'm OK if that's what you are asking:)
@Sab 2048 grid weren't you?
@Kevin That surprises me.
Sab
Sab
Ya
I was asking @PeterVaro :P
15:04
@InbarRose Yeah, I wonder what he's doing hanging around, since he hasn't asked a question since march
Sab
Sab
So @Ffisegydd , what I thought is to consider the grid as a matrix, of rows an columns
But to check each element, I need to make a MASSIVE use of if, elif and else statement
Guys anyone can give me a direction on what i must do with python on that youtube.com/watch?v=OHMLvMhiljM&feature=youtu.be
@PeterVaro You can't count on that behaviour... to satisfy the resize request, a large enough area may have to be allocated elsewhere to satisfy a contiguous block... if it can allocate more memory that happens to be immediately after it may do so
Sab
Sab
Do you think there is a simple way?
@Sab what exactly are you trying you accomplish?
Sab
Sab
15:07
I'm trying to check the values of each element. If the value is equal to the element to the right, left, bottom or top, then return False
So basically, here's a part of what I did. There's still a long way to go since it's a 4x4 "matrix". Now this would not be practical if the "matrix" was 10x10.
@JonClements so basically it would be better, to use malloc to allocate a new area, then copy everything to the new block and then free the old buffer?
Sab
Sab
Here's the code: pastebin.com/4PGLVZJY
@InbarRose: actually, requests 0.8.2 is the standard version that comes with the current Ubuntu LTS release.
I see a distinct uptick in questions about requests exceptions that can be traced to using 0.8.2.
I really would like that question to remain open.
@Sab if something: <-- is more than enough to check if it is True or not, don't use if something == True
@Peter not really... you'll still have the difficulty of updating old references if new memory is allocated
Sab
Sab
15:09
@PeterVaro Ohh nice, thanks. Never knew that lol.
@Ffisegydd Yo!
so realloc is fine, it'll do the malloc and freeing for you, just be aware it may not be the same block you originally had....
@Games Yo!
Sab
Sab
There's too much if statements in that, it's not going to be a practical way of checking all the elements.
@Sab also if something is 0 it means it is False on the boolean test, so you can also use if not something:
don't forget that you == is for bool testing = is for assignment
15:10
Just be aware you might end up with dangling pointers that for a bit might well appear to still work :)
Sab
Sab
@PeterVaro I tried the break, but when I did a trace test, it still printed again and again one time less
Nice tips, thanks :)
in your last line you definitely want to assign False, however, I think what you really looking for is the break keyword
@Ffisegydd The guy could have done everything in numpy instead of using itertools.
@JonClements that makes sense.. yes..
@Sab I'd probably do something like:
#size of matrix
width = 4
height = 4

def in_range(x,y):
    if x < 0 or x >= width: return False
    if y < 0 or y >= height: return False
    return True

#returns True if any element of the matrix is equal to its neighbor.
def any_neighbors_are_equal(matrix):
    for i in range(width):
        for j in range(height):
            value = matrix[j][i]
            if in_range(i+1,j) and matrix[j][i+1] == value: return True
            if in_range(i-1,j) and matrix[j][i-1] == value: return True
            if in_range(i,j+1) and matrix[j+1][i] == value: return True
15:12
Yeah true and some of the answers actually use Numpy and kick ass.
Sab
Sab
@Kevin does it check for top and bottom?
I don't know what you mean
@Ffisegydd But I tried contributing to numpy and scipy, and the internals are creepy.
Sab
Sab
Let's say you are on Element of row 2-column 2
I mean its awesome that it works, but inside the packages are tons of glued up fortran, cython and fortran code :P
Sab
Sab
15:13
Now you want to check for the elements around it(top,bottom, left and right)
@Sab yes it does check top and bottom (effectively i+1, j and i-1, j)
Sab
Sab
Aha.
This code is extremely simple and perfect. I wish I could write it like this.
I consider the j+1 and j-1 lines to be the bottom and top checkers, but I guess it just depends on your point of view
2d matrixes don't really have a well-defined "top" or "bottom"
Sab
Sab
Ya.
Ex. you might consider the 0th row to the bottom one, but it's on top when you print it row by row.
15:15
@Ffisegydd btw, you might want to look at julia
pretty neat new language, and amazing if you mostly use the functional aspects of python
I'm actually thinking of learning R next.
Sab
Sab
The 0th row is the top one for me.
For statistics. Though I'm also tempted to instead learn the pythonic way of doing statistics :P
Sab
Sab
Stats is awesome. I'm not sure if i'll take a module on that next semester.
@Ffisegydd Then try looking into Pydata, there are plenty of resources for stats + python
Sab
Sab
15:17
My adviser is telling me to take it if I want to do AI later.
@JonClements so what am I doing wrong here?
Sab
Sab
@Kevin How do I learn to write code like yours? This is just perfect.
@Kevin My code would have been more than a hundred lines for doing the same thing.
cbg
Sab
Sab
Cbg @Owatch
Interesting name
Does it read: Saab?
Sab
Sab
15:22
Like the car make?
:P
@JonClements this is the output
yeah
@Sab Samuel Beckett says, "Ever tried. Ever failed. No matter. Try again. Fail again. Fail better."
Sab
Sab
Yup.
Cool
15:23
Write lots of code. If it's good code, good. If it's bad code, good - find a way to improve it. Repeat forever.
I like it, a lot. I'm not sure why I'm so interested.
Sab
Sab
@Kevin This is one of my fav quotes.
@Kevin That can only get you so far. You need to write code that challenges you to learn more as well, but nothing too hard. As with all things, its about finding the balance.
@Peter for a start - realloc returns a void*
@GamesBrainiac Yeah. Then, "Write lots of challenging but not too hard code"
Sab
Sab
15:25
Lol
I would never have thought about such an elegant solution though.
It will take me some good practice to reach that level.
@Kevin I mean thats what I found out from a little bit of introspection, and reading pragmatic thinking and learning, by andy hunt.
@JonClements output
I've written approximately one zillion programs that need to iterate through a matrix and do something with each element and its neighbors. I've written code a lot uglier than this
@Peter hmmmph... What pointer type is resources->instances ?
I like to think it gets less ugly each time :-)
15:28
@JonClements void**
instances are pointers of structs
In that case, did you change resources->instances = temp; to be resources->instances = &temp...
Sab
Sab
:)
It's my first time trying to iterate through a matrix
But my algorithm was eww. lol
It's going to no doubt be something to do with one of these two lines:

resources->instances[id] = new_instance;
*instance_id = id;
umm wait.. I think I need an array of void*s. I mean resources->instances should be an array of void*s
so @JonClements if I want that, then resources->instances should be void**, right?
@Peter your realloc is fine... without knowing more about the structure etc... of the rest of it, and being able to shove it through a debugger, it's probably the dereference that's not happy due a mix of void** or void* or whatever.... If they're of a certain type, you should really be casting them to an appropriate type to do pointer artimetic on 'em
15:33
@Kevin stockholm syndrome
Sab
Sab
@GamesBrainiac I read your blog post you posted yesterday. That was an awesome post.
mypy has not been updated for a while, almost year since any new blog post :(
Sab
Sab
Reminds me when I was trying to watch MIT Python lectures. But I stopped since I wanted to learn Python 3.0 instead
groans - it still got answers...
@JonClements does recasting temp to void** make sense?
I think I'm completely lost :D
although it is drawing all the instances, just as it should -- but it is totally nondeterministic
sometimes I get the segfault, sometimes I don't -- but I always get when I iterate through instances and try to delete them
15:38
@Peter time to learn to use a debugger :)
@JonClements brrr.. that would make things too easy.. :P
@JonClements See, in some ways that question is worse than a "plz give the codez" request, since people aren't revolted at the idea of answering it. Now the world has one more spammer, and we're all worse off.
Umm.... I'm sure this one has already been asked by the OP and was orginally deleted
Sab
Sab
I don;t know what files are but I would use a continue in that for loop to skip a row.
Oh thats so cool!
winsound module
Sab
Sab
15:44
rbrb
any reason my mysql.connector is throwing InternalError: executemany() does not support multiple statements error when trying to do executemanywith a dictionary?
cursor.executemany(sql_stmnt, data_list) where data list is a list of dictionaries
@rodling not without knowing what your sql_stmnt is
@rodling Does sql_statement have any semicolons in it?
@JonClements INSERT IGNORE with wide variety of placeholders like %(comment)s for dictionary keys. Works fine in execute
@Kevin YES! yes it does
@Kevin that was the probably the better way to phrase it :)
15:49
someone in this group suggested getting a rubber duck, and every time you have something weird in the code, explain the code to the duck out loud... so you hear yourself outloud
Ok, then. A statement with semicolons is actually multiple statements. But you can't do that, because executemany does not support multiple statements.
...seems like I really need that duck lately
@JonClements what you were saying is: it would be better, if this function only reallocate space and returns the new id, and the array assignment should be somewhere else, where we can assign a properly casted pointer
@MartijnPieters I had the same problem - that's how I found the question...
@Peter depending what you're doing, that would sound more reasonable - when pointing/referencing/incrementing, don't forget it needs to know the struct/object to properly reference it... a void* is not suitable by itself for that
I assume you know that when you allocate a memory, it's purely bytes... so you'd need to allocate memory as sizeof(your_struct) * number_of_structs
15:59
Yes, in my case it makes a lot more sense. Although I changed it, it still crashing.
@JonClements in theory I do know that, yes :):)
Cabbage.
@Peter have you done that though? :p
@poke cbg!
hey hey @poke long time no see
Stack Overflow just makes no sense: stackoverflow.com/questions/23386573/…
@JonClements I guess in that case I need to reallocate memory for the size of: sizeof(void*)*resources->instances_len
I think I forget that one.. OMG.. how could I be that stupid..
16:03
@Peter if you're really nice @poke dabbles in C (or at least lower-level stuff) much more often than I do - so it's probably less of a mindset change for him to look at your stuff :)
@JonClements yeah.. thanks anyway.. it is still crashing
this is an odd question, but how does flask send templates? Does it just translate the whole template to html and throw it at the front end?
@Crow it renders it, then sends it as a response... so yes
@JonClements would it be feasible to implement a page transition between these?
I don't get what you mean...
16:05
the url must also change, preferably without pushing it to the url in a jquery based way
Then you are probably better off returning a redirect to a view that renders the correct response then....
Cabbage!
@Fenikso cabbage!
you're on a page, you click a button that would bring you to another url. It fires a css transition and then that other page comes in
a powerpoint style webpage - sigh
16:08
@InbarRose Then why does it need closing at all?
Does anyone have an idea how to increase size of HTML file which Firefox shows? About 5 years back, we have generated cca 14MB HTML reports (very basic text stuff, bat using hyperlinks extensively) and it worked slow but fine. Today I have realized that Firefox shows like 10% of the file and stops.
The content-length is still being set correctly ?
@JonClements How can I check? It is local file.
So not via a web server... you're opening a local file ?
Yes.
It kind of looks like they have some security setting against overflowing memory or something.
16:12
Anything changed at all? The file is infact the right size on disk? It's not being viewed under a different OS.... etc....
Well, Firefox is much newer version, OS went from XP to 7.
IE opens it correctly.
Chrome also opens whole file, but messes formatting.
@JonClements it's for someone's art portfolio, and some things have "the making of" style pages, so carousel doesn't work well
@Fenisko not sure.... it would seem a weird limitation for FF to introduce now (especially for a local file)... You mention chrome messes it, but IE opens it... It's possible that changes to the parser could just mean it's deciding some stuff doesn't deserve to be rendered anymore...
Hence the entire page is being parsed, but not all of it is visible anymore
@Fenikso good luck with that one :p
I think I can live with IE for now, I am just surprised. It is not THAT unreasonable size.
what's kind of weird is I get distracted from my programming homework by... programming :\ low level stuff is kinda dull.
16:29
@Lewis: Welcome to the chatroom! Sorry, I should have realised you don't yet have the required 20 rep to speak.
Just 5 more points and you can. Hang in there!
Oh to hell with it, another question upvote and you have the +20 required.
It'll take a minute or so to sync over to the chat server.
Cabbage.
So fess up, who wrote this rant?
@abhi Cabbage!
It's nice you've found a useful function from someone else's code from the duplicate answer that's been linked - I have correctly attributed the code, but bearing in mind any future posts you should do so yourself when copying code that is not your own effort (and make an effort on formatting it so it's correctly indented (as it's still not!)). Focus on the line '(%s)' % ', '.join(r) - and try to understand why that puts brackets around the return result. As to your other query, there isn't 's in the string, that's just Python's way of displaying a string when used interactively.... — Jon Clements 36 secs ago
what is customary to put on a personal/professional website?
^^^ can't say more than that... if the guy can't remove brackets, no way are they going to be believed handing in that function :)
@Crow personal stuff and professional stuff generally :p
16:35
okay, definitely putting information about my favorite breed of dog, and movies I like, and what the best kind of chocolate is... employers will love this!
Generally if you want to bitch about a workplace, do it anonymously. Even if it isn't your workplace.
All programmers are forcing their brains to do things brains were never meant to do in a situation they can never make better, ten to fifteen hours a day, five to seven days a week, and every one of them is slowly going mad.
yeah I'm trying to make a professional site but it makes me realize how boring I am... it's pretty sparsely populated right now
I am sitting with Data Tools in VS 2013 and trying to sync one development database with another.
Does this bug happen to anyone else? Steps to reproduce:
1. Click the "answer this question" button on any question page.
2. Enter text into the "your answer" box.
3. In the preview box, highlight part of one line of text.

When I do this, once I release the mouse button, the text un-highlights, and focus returns to the "your answer" box. If I highlight more than one line, the text remains highlighted as expected.
Cbg!
16:39
@mamasi Cabbage!
@abhi That only happens to humans... Being a cartoon puppy I'm immune to the insanity thing... :p
How many of you work ten to fifteen hours a day? I put my foot down at 9.
Good for you @Jon
I usually work every alternate weekend. Also I am checking mails when I am at home.
Sometimes responding to them via the phone.
So who's counting?
@Kevin I do have the same in FF.
Ooh, reproducibility!
May I ask your version and OS? I think I'll make a post on Meta
16:45
Cabage
@TJonS cabbage
I am having a unique issue that may be python related.
I have a web service using python and django. It serves content to a mobile app
Basically, I am getting different values from the service for the app versus my browser
Any ideas, @all?
@Kevin Win 7, FF 28
@Fenikso have you tried FF29 yet?
(It's awesome -- like I might give up chrome)
@TJonS errrr... not sure how anyone can answer that as it stands :)
16:50
@TJonS I think you'll have to provide more detail than that
@TJonS I am not really installing a new version imediatelly, as I use Portable version. What is so good on it?
@Fenikso the UI is really nice
@JonClements @Ffisegydd here is the url of the service: 54.201.100.214/us
@TJonS OK, I will have a look. I would rather if it opens my 14 MB HTML than better UI :).
You will notice the values in the JSON are both 5
the app displays zero
is there anything wrong with doing this? do_method(var1, var2, self.var3)
16:54
@JonClements HAHAHHAHA I made it to work!
and my original idea was okay: temp needed to be a void**
but you helped me figure out the missing of the sizeof(void*)
thanks!
@Crow I do not see anything weird, without context.
gah, biting my tongue.
I so want to tell the OP of this post that he comes over as overzealous and is assuming bath faith at every turn.
@MartijnPieters I am no lawyer and cannot give advice related to the law, neither can you, I brought up a question that I felt was important trying to look for answers. Good to know how welcoming the community over here at Meta is, have fun estranging new users... — PW Kad 8 mins ago
Here's hoping I estranged him enough.
@Sab Heya! Thanks for reading it.

« first day (1292 days earlier)      last day (3880 days later) »