« first day (2154 days earlier)      last day (2806 days later) » 

11:07 AM
Cabbage guys
a quick question
why doesnt "runsikulix -rftest.sikuli" work but calc.exe works when trying to invoke both using python "os.system statement
i get error stating " runsikulix" is not an internal or external command
but when i double click the .bat file it works
 
Try specifying the complete path for the file.
 
only through python its not working.
import os
os.system("E:/sisource/gtest.bat ")
the above is my python code
runsikulix.cmd -rftest.sikuli
This is the content of my .bat file
 
I'm not sure how batch works. If you want to keep the .bat file, change "runsikulix.cmd" to the whole path of that executable.
 
OMG that worked
Dude you are a genius
 
Just keep in mind that anything that is not an absolute path is translated somehow to the absolute path.
For future debugging
 
11:13 AM
Ahh.. Got it. new learning
 
:)
 
Thank you so much
 
You're welocme
 
11:26 AM
@khajvah no I really didn't. I wanted to like it, but feel like it has ad-hoc syntax, bad tooling and so on :D I like Java instead
 
You like Java?
 
@AnttiHaapala You like Java? :O
 
yes
yes!
 
bad tooling is Java probelm too
 
I like Java. It does not mean I like someone else's Java code
 
11:28 AM
@khajvah Hey, looks like all scatterometer carrying satellites are named as ".*scat.*" :D
 
syntax is odd I agree but I like the resulting cute codes
@BhargavRao :D
 
Found this out now!
 
Java tooling is excellent. It is fast to incrementally compile Java code. It is easy to introspect binaries (jars, classes), etc.
 
NASA's satellite is called RapidScat :P
 
@AnttiHaapala what you mean by tooling
 
11:29 AM
@khajvah compilers, IDEs, code quality tools etc...
 
ok got you
Intellij has pretty good Scala integration
 
platform support
I haven't used IntelliJ though.
 
Diagnostics support
 
sbt is alright roo
 
the biggest JVM project I've had is this system built on Eclipse
 
11:30 AM
although it gets really slow sometimes
I hate Eclipse. It's ugly
 
not really different from IntelliX
it is like comparing chrome to firefox
 
I hate all IDE's :p
 
I am talking about GUI design
code highlighting
I find intellij beautiful
 
the point was that the product I am working on is kind of eclipse addon
 
oh
 
11:33 AM
I wanted to test scala for that but the eclipse scala plugins didn't work.
I've been wanting to use Xtend...
but it didn't work too well 1-2 years ago
Xtend can be compiled to Java source code
 
I want to try OCaml
heard good things about it
 
also what bugs me with Jetbrains offerings is that it is closed source
it is really annoying, I cannot fix any bugs in it myself, unless I reverse-engineer it
 
@AnttiHaapala cute
 
@khajvah You could get a job at Jane street :p
 
@gowrath lemme google that
they use OCaml ?
 
11:37 AM
Yea, one of the few places that do
jane* street
 
They basically EFT trade
+ pay their employees a lot
 
Yeah Jane Street looks cool
 
@AnttiHaapala Lovely distinction between data type and object
 
@khajvah remember, all this compiles to 100 % java code.
so it works with android as well, which doesn't have JVM...
or even with JavaME.
 
11:40 AM
dunno. I like Scala but JVM world is scaring me
.NET world too.
 
What are your thoughts on Haskell?
 
they look too complicated. I like simple stuff
 
I haven't properly learnt a functional language yet
 
@khajvah jvm really rocks
 
@gowrath I am rather new to it
but I loveit so far
 
11:41 AM
Thinking about which one to start with
 
@AnttiHaapala it's the environment that scares me
I remember when I first touched Java. I couldn't do anything outside an IDE
I hated that
 
brief cabbage
 
o/
 
@khajvah well, you certainly can do but...
 
we've moved 2 rooms away last week, because another department is being renovated and our department offered them our big old room temporarily, so we moved to a small new room
and it's scorching hot here:(
 
11:46 AM
... java is a language for which one can build pretty decent
@AndrasDeak stop whining. it is cold here.
 
let's switch:P
if it's cold, you can always wear another layer of clothing
 
I'm with Andras, it's almost always easier to heat up.
 
@AnttiHaapala do you like C++?
 
@khajvah no. I hate it with passion.
 
nice
 
11:48 AM
I can tolerate it, but... it is horrible.
@khajvah how many lines of code in C++ hello world?
 
We have a saying at our university
There is only one person who actually knows C++
 
@AnttiHaapala 5
 
@khajvah 18163.
 
I dont get it
 
% g++ -E test.cc|wc
  18163   40038  428304
 
11:50 AM
well that's not language's fault, is it?
 
of course it is.
you need to have the implementation of everything in header files...
 
@AnttiHaapala 48 bytes :)
#include<cstdio>
main(){puts("Hello, World!");}
 
C hello world only has 852 lines of code
 
isn't C the same way?
 
also, in Python, you have a dict for mapping string to string
 
11:53 AM
about header files
 
@khajvah the implementation is not in header files.
thus 852 vs 18163
 
neat
 
@AnttiHaapala oh I misread your first sentance
 
@khajvah you compile a java hello world: 5 lines of code, python hello world, 1 lines of code to compile, c hello world 852 and c++ hello world 18163 lines to compile.
whoever designed the last one must be crazy. It wasn't designed, it just happened.
 
wasn't it a committee?
 
11:55 AM
Right but it's also faster
And you know, used for systems and shit
 
@AndrasDeak yes, it's a camel
@gowrath faster? C++ is faster than C?
@gowrath or Python??
dream on
 
@AnttiHaapala that has something to do VMs
right?
 
C faster than python^
 
C or C++?:P
 
9
Q: String matching performance: gcc versus CPython

RomanKWhilst researching performance trade-offs between Python and C++, I've devised a small example, which mostly focusses on a dumb substring matching. Here is the relevant C++: using std::string; std::vector<string> matches; std::copy_if(patterns.cbegin(), patterns.cend(), back_inserter(matches), ...

 
11:56 AM
@AnttiHaapala this is not fair
 
^^
 
@khajvah not fair to compare C++ to Python?
not fair to compare the C++ standard library with Python standard library?
how?
 
@AnttiHaapala not fair to compare C module and call it python
pretty sure this is an exception
let me rephrase: most of the time this won't happen
 
so now you need to write everything in Python? What can we use? are dictionaries ok?
 
real world applications not tiny snippets that call a C module
 
11:58 AM
Eh I think it's a pointless argument
 
the problem with C++ is that the standard library is stupid as hell.
 
C/C++ are considered one of the most effective languages
 
C standard library is stupid as hell, too... but at least it doesn't pretend to be not stupid
 
well I don't like C++
 
"Use a special algorithm in C++ to get it almost as fast as Python" — Antti Haapala Mar 15 '15 at 21:07
 
12:01 PM
I think one should write a simple monte carlo simulation in both cpp and python (but numpy), and see what happens
speaking of which, I'm off to listen to a quantum monte carlo lecture:D
hooray for cognitive priming
 
I had a PDE class today. It is really challenging
 
pde?
as in eclipse?
 
partial differential equations
 
those are fun:)
 
12:04 PM
I wasn't familiar with that acronym
PDE stands for Plug-in Development Environment
 
:D
yeah right;)
anyway, \o
 
:(:(
I haven't needed calculus at all since I graduated
 
I might move to game development to do some math
 
which kind of sucks :D
 
have you tried?
I like math
 
12:06 PM
Math? You need math for programming? Pff
 
@khajvah PDE < PDF :)
 
(I like math too)
 
@Slayther no you don't
 
@khajvah Many of my friends told me: "I won't even try to learn to program. I just hate math" And I'm like.. ._.
 
@khajvah I haven't had a single problem at all where I'd have thought "ok now we need calculus" :(
 
12:08 PM
they say game development has some math
 
AI needs maths
 
Well, of course. Everything has some math in it
 
not even things like ~"ok what's the growth rate of x²"
 
@Slayther I think the mindset is the same
if you hate math, you will probably hate programming
but if you really hate math, you haven't been taught well
 
^ This
 
12:09 PM
I agree
 
@khajvah Id have to disagree. They are tangentially similar but I know a lot great mathematicians who hate programming and a lot of great programmers who couldn't write a proof to save their life
 
I once taught a friend what arithmetic series is all about
 
I love math, but not enough any longer it seems...
 
@khajvah I think that depends on the kind of programming you're doing. For a lot of programming you don't need much apart from basic arithmetic.
 
He asked me "How much reps did I do if I did pyramid from 1 to 10?"
I said: "55"
He said: "How did you do that?"
I said: "That's arithmetic series. Take 1 and 10, add them: 11. Multiply by half of the number of sets. That's 5. 11 * 5 = 55"
Who says you don't need math outside of class. You just need to know how to use it. And schools don't teach that.
 
12:12 PM
The thing with differential equations is that if you don't do them regularly you forget the patterns and tricks, and you end up trying various techniques by trial and error.
 
@PM2Ring yeah that was why it was waste of time to me :P
 
@PM2Ring I want to learn the theoretical part
but my class is more practical
 
been >10 years since my differential equations course
so I remember absolutely nothing.
 
I look at math as a toy for now
pretty sure will never use ring theory anywhere in my life
but it was fun
 
@khajvah you probably wouldn't :D
 
12:14 PM
I was recently trying to solve a DE for a SE.Physics question (which I didn't end up answering). After 2 fruitless pages of work I realised "Oh, I can just do this simple substitution", and solved it in like 5 lines. :)
 
I also had a course on numerical methods
I remember nothing from it, except that it also had Newton's method. If I need to use Newton's method, I probably have to look it up in wikipedia :D
 
that's true about everything you learn at school really
 
numerical methods \neq maths
 
@khajvah Well, modular arithmetic is a simple ring theory, and that can be rather useful.
 
yeah but it's the most basic thing
 
12:17 PM
so really, half of highschool math has been useless in retrospect and 90 % of everything at the university :D
 
in my abstract algebra course. The rest was just weird stuff
 
but it was fun then
 
I could choose computer science to do more computer oriented and potentially useful stuff
which would probably be a better choice :D
 
well...
machine learning and such will get more and more important
 
yeah I thought so too. In CS I would have course in cryptography or OS development, which are interesting but really not that useful
 
12:24 PM
os development is kind of important
but diminishing
cryptorgraphy is always important
can't you mix and mash...
 
yeah well but they don't change
you will still use the same stuff
 
Is there anyone with experience with IronPython?
 
@khajvah True. But it's nice because it's easy to make concrete examples. And those examples can be helpful when trying to understand ring concepts as applied to more abstract rings. And of course, modular arithmetic comes up a lot in cryptography, so it can be very useful to have a solid grasp of modular arithmetic.
 
yeah but 99 % of cryptography problems is because wrong application of the "same stuff"
so it depends on the cryptography course :D
if it is about "this is how you do RSA with 3 and 7 and modulo = 15" then forget it :D
 
@AnttiHaapala learning to use crypto shouldn't be too hard
 
12:30 PM
@khajvah exactly, it is evidenced by the fact that everyone is using crypto correctly.
 
FWIW, I wrote some Python code a while back that efficiently finds solutions of x²=x mod m, usingthe Chinese Remainder theorem. Of course, if x²=x then x³=x², etc. A couple of days ago, a simple case of this came up in a SE.Mathematics question: find n-digit numbers (in decimal) whose squares end in the digits of n. For small n a simple brute force search is fast enough, but it's nice to be able to avoid brute force, and for large n it would not be practical.
def xgcd(a, b):
    ''' Extended Euclidean GCD algorithm '''
    x0, x = 1, 0
    y0, y = 0, 1
    while b:
        q = a // b
        a, b = b, a % b
        x, x0 = x0 - q*x, x
        y, y0 = y0 - q*y, y
    if a < 0:
        return -x0, -y0, -a
    else:
        return x0, y0, a

def self_squares(n):
    ''' Find n-digit numbers whose squares end in the digits of n '''
    m = 10 ** n
    a, b = 2 ** n, 5 ** n
    x, y, _ = xgcd(a, -b)
    return -b*y % m, a*x % m

# Test
for i in range(1, 9):
 
@DrakaSAN If you have a question, just ask it
 
user559633
cbg
 
cbg tristan
(and everyone else, for that matter :)
 
@tristan You really should post your modified XKCDs to the forum, where they'll be appreciated by the connoisseurs. If you want a XKCDish font, check this thread
 
12:43 PM
An interesting math problem occurred in my life. With some details changed for anonymity, it was: "Alice wants to cut down on her smoking habit. On Tuesday, she smokes. Then she skips a day. On Thursday, she smokes. Then she skips two days. On Sunday, she smokes. Then she skips three days. On Thursday, she smokes. Then she skips four days... And so on. Will Alice ever smoke on Wednesday?"
 
user559633
@PM2Ring Oooh, good call on the font. If I decide today to give twitter a valid phone number to unlock the account, I'll try my hand at another one. I was hoping the xkcd forum would "find" it, but I think if I make ~25 and no one has, I'll try a link. It would erode some of the experience for "true fans" of XKCD if they get a link with the context of "hey y'all, i think you people are generally smart/nice people and randall really knows his audience, but here's some low-brow garbage"
 
I think this generalizes to something like "For positive integer values of x, is the set of all results for ((x^2 + x)/2) % n identical to {0, 1, 2... n-1}?"
 
That is actually an interesting math problem
 
Isn't it just an arithmetic prog mod 7?
 
I'm pretty sure you can brute-force an answer in a couple minutes, since skipping 9 days is the same as skipping 2 days for the purposes of determining day-of-week
 
user559633
12:47 PM
Wouldn't it just turn into "if wednesday is odd, will the series result in an odd number?"
 
I have zero formal education in modular arithmetic so I don't know how difficult this is to solve if you do have said education
 
Answer is no
I think
 
@tristan Oh, ok. The people on the forum these days are a pretty broad spectrum. Some are die-hard fans, some have almost given up on the comic, saying it jumped the shark years ago, but they still like to hang out on the forum because it's a (mostly) tolerant and diverse bunch, and the moderators are pretty good at dealing with what little crap arises.
 
Let's see...
>>> def f(x):
...     return (x**2 + x)//2
...
>>> {f(x) % 7 for x in range(1000)}
{0, 1, 3, 6}
 
I'm walking rn; i'll try it when i sit down
oh nvm
 
12:49 PM
My lazy half-complete empirical approach suggests that only Monday, Tuesday, Thursday, and Sunday are smoking days.
 
@WayneWerner: Well, I am having trouble using Edge.js, which allow me to run IronPython script from node.js. Problem is, the module want me to use v2.7.0.40. I have v2.7.6.3.
Searching for IronPython 2.7.0.40 does't get me any installer for windows. I tried using Ubuntu in VM, but Ubuntu 14 can't find libjpeg62-turbo, Ubuntu 16 can't find dotnet-sharedframework-microsoft.netcore.app
 
Extra credit: find a value of n where the sequence does iterate over all numbers from 0 to n-1, or prove that no such n exists.
 
user559633
@PM2Ring That's pretty much what I expected. He's made almost 2000 of the comics, so it would be rare if the forums were mostly mild fans
 
Extra extra credit: if they exist, find all possible values of n where the sequence iterates over all numbers from 0 to n-1.
 
Oh i think i can prove it
Let me just double check
 
12:55 PM
I guess the extra credit is easily solved with the degenerate case: n=1.
 
Ok so here it is
Let's enumerate the days as such: {Tue:6/-1, Wed: 0, Thurs:1, Fri:2 ... etc}. Then we start at -1 and first add 2 (skip one day) which gives us 1 (Thurs), then we add 3 (skip two days) which gives us 4 (Sun), and so on
 
@DrakaSAN Why not just use a subprocess?
or something to that effect
 
Now we are operating under mod 7 because these are days in a week ( that is we wrap around every 7). To generalize, starting on -1 (Tuesday), the (k-1)th day Alice will smoke is -1 + (2+3+4+5+..k). Using the sum of arithmetic progression formula, the the k-1th she will smoke is -1 + (k-1)(k+2)/2.
 
@Wayne: I need to pass and get back JSON object, with subprocess, it mean checking the OS to find out how to prevent the " escaping
 
We just need to prove that -1 + (k-1)(k+2)/2 is never equal to 0 (wednesday) mod 7. Equivalently, you need to prove (k-1)(k+2) is never a multiple of 7.
 
1:03 PM
With you so far...
 
@DrakaSAN I... don't think so? I don't know how JS executes subprocesses, but in Python if you do something like this...
import json
import subprocess

data = json.dumps({'foo': 'bar', 'cool': True, 'escapes': None})
subprocess.check_output(['fnord', data])
it will pass one argument to the fnord command. You might have to have shell=True in there? Not 100% sure on that
but the argument that you get in fnord will be valid JSON
subprocess handles all the escaping itself
on the return, if you were to print(data) then whatever is reading it should also read it just fine
 
@Kevin Proof is left as an exercise to the reader ;)
Sorry I miswrote
 
On second thought I don't know if I agree with the "Equivalently" sentence since for k=5, (k-1)(k+2) = 4*7 which is a multiple of 7
 
I meant you need to prove (k-1)(k+2)/2 is never 1 plus a multiple of 7. That is, (k-1)(k+2)/2 == 1 (mod 7)
You need to prove that for all k, (k-1)(k+2)/2 != 1 (mod 7)
 
I want to get number of days from formatted date..
datetime.strptime(date_formatted, "%Y-%m-%d")
But it doesn't have days attribute?
 
1:12 PM
Define "number of days". For example, what is the number of days for today, Sept 8 2016?
 
cant' work today
 
Number of days since January 1, 1 AD? Number of days since the Unix epoch? Number of days since the start of the month?
 
In node.js, it will be a `child_process`, which internally execute a command in the OS's shell:

'use strict';
let exec = require('child_process').exec;
exec('python myscript.py {"foo":"bar"}', (error, stdout, stderr) => {
//...
});

And at least on windows, the shell will escape all `"` character.
Also, since you can only get back whatever is in stdout, it impose huge limits on what you can do in the python script.

With edge.js, it call IronPython directly, and you can call the script as if it was a JS function:
 
@Kevin Unix epoch would be good
Now I see it is vague question
 
Whoops, gotta go, but as my parting comment I suggest timedelta
 
1:13 PM
@Kevin Ok, thanks.
 
@WayneWerner: So in short, basic subprocess are using the terminal, and impose huge limit, edge allow me to do a equivalent of subprocess in python, but need IronPython
 
@Kevin Parting hint: (k-1)(k+2)/2 - 1 mod 7 cycles 6,1,4,1,6,5,5
Thanks for the question
 
@Kevin i*(i+1)//2 % n iterates over all elements of range(n) iff n is a power of 2.
 
@DrakaSAN pipe the data into the script with stdin, just like you'd get the results through stdout.
Also, I find it surprising that node doesn't offer a way to execute a process without a shell, or to escape a string for use in the shell.
 
Note that if t = i(i+1)/2 then 8t+1 = (2i+1)²
 
1:19 PM
@davidism: Edge still have the upside that I can put whatever debug output I want in stdout, while with child process, I ll be limited.
I m searching for other ways, but edge was really promising for me.
 
Ok, I'm back.
@Slayther I was thinking something like:
>>> import datetime
>>> (datetime.date.today() - datetime.date.fromtimestamp(0)).days
17053
 
@Kevin Yeah, I did that exactly. Thanks.
 
@PM2Ring Neat. It isn't obvious to me why that's the case, but I believe you.
 
Morning cabbage.
 
@Kevin I haven't actually got a proper proof ATM. But I'm pretty sure it's correct: I did a brute force test up to 2048. :) I'm rather tired, and I need to get up again in a few hours, but I'll try & put together a proof tomorrow. :)
 
1:29 PM
Brute force is what I was planning on doing myself, so I would be remiss to demand anything more rigorous from anyone else ;-)
 
for m in range(2049):
    a = {i*(i+1)//2%m for i in range(m)}
    if len(a) == m:
        print(m)
 
@MorganThrapp cbg
 
I'm having &quot;flashbacks&quot;: meta.stackoverflow.com/questions/334121/…
 
@davidism lol :)
 
I wonder if they put that specific "this might be spam" notice in because of me.
 
1:40 PM
Nope - but that'd be an awesome thing to be noted for though :)
 
@davidism That should be marked as dupe of yours :D
 
stackoverflow.com/q/39388131 mcve / no repro (also flag the link only answer)
 
cbg
 
Cbg, idjaw!
 
o/
 
1:55 PM
Aye Aye Capt'n!
 
aye
 
DSM
Morning cabbage.
 
cbg @DSM
 
Cabbage!
 
Cbg, DSM!
 

« first day (2154 days earlier)      last day (2806 days later) »