« first day (2360 days earlier)      last day (2813 days later) » 

00:11
Hey
I am looking for solutions to the integer linear least squares problem for use in my python project. Any advice on where to start?
00:27
Ya that is where I started looking, but I did not see anything related to integer solutons.
There is no "the integer linear least squares problem", least squares method is just a tool.
ILLS is x = argmin(norm(Ax - y, 2)) with A a matrix and y a vector such that x is a integer vector. If x is not restricted than scipy.optimize.lsq_linear works well
In general "Integer programming" is NP-complete
I did see Routines for solving the standard integer least squares problem so my next step is to convert that code from matlab.
01:05
Does max vs operator.add make this question not a duplicate of this one?
@paul23 it still makes sense to try to find a "Diophantine" least squares optimum
01:45
@TigerhawkT3 They're certainly related, but I'd be hesitant to dupe-hammer. It's probably a good idea to link them with a comment, though. The answers in the new one have some good info. And some of the answers in the old one don't apply to the new one, eg the Numpy cumsum stuff.
01:58
@PM2Ring My litmus test is basically "would someone be able to resolve their issue by reading an answer on that page instead of this one," and in this case that holds very true. OP of the new question already knew what function they wanted to apply, so they just would've had to swap it in. Not all of the answers are perfect, but if they were we wouldn't need to allow multiple answers or have a voting system.
 
6 hours later…
07:29
@TigerhawkT3 again remember how google works.
when an anonymous user comes via google, they will be redirected to that dupe target immediately without any comments.
@AnttiHaapala that's bad
@khajvah it is good
in general. but not good if someone is as heavy-hammered as @TigerhawkT3 :D
I actually had a deja-vu
 
3 hours later…
10:40
cbg
is this new?
I have most things filtered via noscript, but this is the first time I'm seeing that banner
perhaps one of the ads used javascript unlike the usual ones
Hi,
i have a question...is there any way to put an old, un-answered question back to top ???
@Marcus "Back to top", you mean on the front page? If you edit it, it will be bumped to the front page, but that should generally not be abused, so don't just edit it to bump it. If you have an older question, there's nothing in the room rules that forbids you linking it here, where it might get some attention. And if you have enough rep (probably not), you can post a bounty to give it extra visibility.
either way note that the site (both main and chat) has much less traffic on weekends
10:55
ohkay, its only a day since the question ... so in a week i will think about an editing ;) ... I am just siting here and waiting, with crossed fingers, that somebody can give a hint. I wont to finsh that project, and thats basically the last concern ;) ...
wont=want
heh, "old" :P
yesterday was a weekend I'd try posting your question here on ~Tuesday if it doesn't get more attention
if you do edit it later, remove the salutations at the end
ohay, thanks for the tip ... I will do as told ...
cya and good rest-weekend
user6845426
cbg o/
 
3 hours later…
13:50
cbg! Is there a way to find out whenever a new entry is added in MySQL database table? I need to execute a function whenever a new user signs up. The signup procedure is from different language.
@Grimlock Polling is a crude way of doing that. (Maintaining your own id counter or something)
And from primary research, MySQL UDF seems to be an advanced method, which would seem like an overkill.
Oh, this is all new to me, can you link any good example of it? I am searching for the same atm.
Hey guys, any ideas why the following is printing my file out?

out_file = open(file_two, 'w')
out_file.write(indata)
reading = open(file_two, 'r')
print reading.read()
@ManuelStoilov you didn't close out_file between writing to it and opening it again?
Nope. Should I close it between writing to it and reading it?
14:03
yes?
Cabbage
otherwise opening in write mode or opening in read mode would make no sense, you would just open it
@PM2Ring cbg
@Grimlock Try searching for mysql hooks.
@ManuelStoilov Hang on. You asked why it IS printing the file.
I assume a typo
14:05
I certainly wouldn't expect it to print anything, but I guess you could get lucky with a generous operating system. ;)
yep it's a typo. sorry guys. It wasn't printing anything
@AshishNitinPatil Isn't hook simple a connector? I use pymysql for it. How do I constantly check DB inserts with it?
you could also use a context manager to force yourself to do it separately
with open(file_two, 'w') as out_file:
     out_file.write(indata)
with open(file_two, 'r') as reading:
     print reading.read()
@ManuelStoilov Be careful with typos that completely reverse the meaning of what you're saying. They cause confusion with humans, and can cause disasters if you put them into your programs. ;)
14:07
(hopefully that's how it works, I don't think I've actually used context managers)
@Grimlock "Constantly check" == cron
@AndrasDeak Yes, that's perfectly correct. But why the yam don't you use with blocks?
You can write a script and have it execute regularly as a cron job
Oh, thanks for the info, never knew what it's meaning was, looking it up in Python.
*its
Awesome, thanks for you help kind strangers :)
definitely did the job
14:09
@PM2Ring Because I don't usually read from files manually, only using numpy methods. The only times I've done so was during advent of code, when something like indat = open('day20.inp').read() was fine ;)
@ManuelStoilov no worries
@ManuelStoilov BTW, this isn't a Python issue - that's the way files work on virtually any OS you're likely to encounter.
@AndrasDeak OK. You're forgiven. ;)
phew :P
SO needs more Discworld fans - too many people on Meta thought I was being serious with this comment:
Some people aren't comfortable with the term "Necromancer". Perhaps that badge could be renamed to Post-mortem communicator :) — PM 2Ring yesterday
yeah, got some interesting links, including one to a feature request that was actually about renaming the badge :|
@PM2Ring that was an april fools noke, right?
14:13
@paul23 Not really. It was me taking an opportunity to reference Discworld.
on the Southern hemisphere they celebrate April Fools on October 1st
:) I didn't even notice it was the first of April until quite late in the evening.
Google autocorrect working as intended :)
Searched for "why use xml over json", got first result as "Why JSON is used over XML?"
XML is ok for some things. But JSON is certainly easier to work with (and to read) when you don't need the full power of XML.
Eg, I don't mind that SVG files are XML, and I think they'd look weird as JSON. OTOH, I wish EPUB used JSON instead of XML.
all the things I don't open in vim:)
14:22
And I've seen some horribly structured JSON in SO questions. And I'm not just talking about deeply nested mazes of data. One thing I find particularly annoying is JSON lists of single item dictionaries.
15:17
@vaultah Hmmm. I might write a new answer for that dupe target you used to hammer this. A stack is useful if you've got several bracket types to deal with, but when there's only one type of bracket a simple counter is all that you need.
Maybe there's a better duplicate that I overlooked
Perhaps. But it's getting late here, and I've had a long day, so I don't feel like searching for it. ;)
16:17
How do I debug a difficult problem with an undocumented api like opencv?
16:34
Or WHERE the hell is the documentation for pyth-opencv? I have only found an outdated tutorial.
16:52
@linuscl opencv is well-known for the level of hard-to-find-ness of its documentation
once you find it, it's fine
Mar 29 at 14:34, by Andras Deak
you need to cross fiery mountains and swamps full of poison gas to find the old sage who can tell you where actual documentation is for a given function
what function are you working with?
for instance there's things like docs.opencv.org/2.4/modules/imgproc/doc/…
you often need special magic, like googling "opencv <functionname>" and scroll all the way down to search hit #6 or #8
user6845426
17:19
lol
17:46
@AndrasDeak But as you should see, the documentation is outdated (version 2.4 whereas the uptodate version is 3.1). For example what I'm looking for is accessing the upright integer of the SURF class. -> docs.opencv.org/2.4/modules/nonfree/doc/… In my version it is not accessible with surf.upright anymore. Also SURF() changed to xfeatures2d.SURF_create().
yeah, I've got nothing
I have 2.4 installed so I've never run into this problem, and even with 2.4 I've had instances where it took me a while to find some docs
I assume this is the tutorial you were talking about
at least that's 3.1
18:34
solved, thanks :) will google and do a looooot of research.......................
19:03
no worries, opencv really is a pain in the butt sometimes
user6845426
Second that
user6900888
22:30
Hi all
user6900888
I need little help
user6900888
here is my code , https://pastebin.com/LCYuV8rX

i am getting this error :
[''.join(l) for l in ks]
TypeError: can only join an iterable
ks is an iterable that contains non-iterable things
your code assumes that ks is a list or tuple (or ...) of a list or tuple (or ...) of strings, but it's not
user6900888
ok but if i iterate over ks then it print ks[0] ks[1] then how it is not ?
22:34
ks[0] itself should be an iterable
''.join(l) will try to do something like l[0] + l[1] + l[2] + ... using string concatenation
for this to work l itself has to be an iterable, and one that contains strings
if you just want to join ks, you need ''.join(ks) and no list comprehension
user6900888
ok so i am adding/ merging two list and i don't want "[]" in final output , Is there any other way ?
please try with a small dummy example
I mean an MCVE
user6900888
sure but i need little guidance , I used to program in python but i was away from python since 4 months so i forget many things.
What I meant is that show me an MCVE with some dummy lists and then I'll understand what you need and I'll be able to help you
user6900888
sure wait
22:38
"i am adding/ merging two list and i don't want "[]" in final output" is unclear to me
each list should have 2-3 items, and they should be similar to your actual data in terms of type
user6900888
can i show you output of print of each list before adding ?
no, I'm worried that your actual lists are needlessly complicated right now
or are you unsure what your lists contain?
user6900888
Please take a look of code and output now
user6900888
i think it will help you to understand what i want
22:42
2 mins ago, by Andras Deak
no, I'm worried that your actual lists are needlessly complicated right now
user6900888
Yes they are
I'm glad we agree
one of your elements is literally 14 lines long in that pastebin
anyway, as you see, you have 1 list, each element of which is a message, whatever that is
user6900888
Yes , so i want final out (output of ks=l+ka) without brackets
apparently a message is not an iterable, and even if it was, I'm fairly sure that ''.join would fail for them
there are probably several hacky ways to do what you want
what you see is the str() of your list, which I think contains the repr() of your message objects, or maybe their str(), I suspect that for these objects the two are the same
the reason why you see the brackets is that ks is a list, so if you print it, you usually do want to see those brackets
user6900888
yes you are right ks is list but i want final output without list format
22:47
try joining the repr of your messages: print(', '.join([repr(k) for k in ks]))
user6900888
@AndrasDeak It worked thanks :)
user6900888
I hope it will not change quality or encoding after converting to repr ?
the result will be a string, very different from your original data
but it doesn't change the underlying list if you don't assign to it
as always in python, when in doubt, just try it out
23:05
I think we as Europe should finally make an army and conquer the US
It's just unsafe at the moment.
user6900888
Hey @AndrasDeak there
user6900888
Hi , So far i am able to achieve what i wanted but here is a little issue.
user6900888
first see this
user6900888
i can only add message one by one like :

track.append(Message('note_on', note=64, velocity=64, time=32))
user6900888
But i have whole list of messages
okay
so append each, one by one
for msg in list_of_messages:
    track.append(msg)
user6900888
let me try
23:13
@Baap By the way the description in your profile is not the example of recursion :P
cbg all
user6900888
@MoinuddinQuadri yeah because it doesn't have base ?
No. Because it doesn't have any pattern
Just a repetition of word Python doesn't makes it recursive
user6900888
23:30
@AndrasDeak no luck
that's too bad

« first day (2360 days earlier)      last day (2813 days later) »