« first day (274 days earlier)      last day (2947 days later) » 

5:28 AM
@excaza tried that code. Number of lines returned is 0 on one of the plaintext files I tried.
@excaza never mind. I tried a blank file
It seems to work on Mac OS
 
 
2 hours later…
8:10 AM
@rayryeng @Amro party ended without me, someone else achieved 97% accuracy using DNN? I did that last week using some insane training set on keyword classification, but could not reach any higher.
 
@AndrasDeak but Finnish for beer is "olut"
 
8:45 AM
 
@Adriaan I believe this exact link appeared in the comments to the above post
 
might be :P
I know too little about programming in general and XKCD to have a borad scope of applicable knjowledge on this point
 
 
2 hours later…
10:52 AM
@Adriaan because it's not a Finnish word, it has Finno-Ugric roots
the Finns probably dropped it for the Northern version
@Dev-iL windows! what r u doing? windows staaahp
 
11:46 AM
masi pls
 
again?
argh
how about some identifity matrix for ya?
 
@AndrasDeak dafuq o_0
 
I was going to comment "wat" but that would've been rude
 
hiya
 
Hello!
 
11:52 AM
@Dev-iL so I dont know if I should believe this or what, it's a day early for april's fool!
windows running Linux ELF binaries natively!!
wtf
 
It's really time I left ubuntu
@Amro it's been around for days
unless it's a huge April fools setup
 
@Amro Yeah, this has been speculated.. Though it's a badass timing for a huge and "unbelievable" feature release
Any of you guys in the mood for solving a SO question using recursion?
 
you mean "bad, ass";)
@Dev-iL sounds like homework
whenever the method is specified, it's homework
 
nope... It's just how I think it can be solved
 
11:55 AM
@AndrasDeak I mean the tech is not new. they had the UNIX subsystem for years, but they deprecated it with Win8
 
I already provided a solution using loops, but then started to think of a recursive one
 
though that was a bit different, since that was like win32 ports of GNU tools
 
but I'm having a difficult time deciding whether I should do it using BFS or DFS :D
 
-3
Q: index must be positive integer or logical

M.FanI am using an explicit/implicit scheme for Gravity waves in one dimension and I'm using the following code. ntot = 100; jmax = 100; j = 50; h=10; dx = 1000; dt = 0.5; a = (dt*h)/dx; for j = 1:((n+1)) %Initial conditions U(:,1)=0; U(jmax/2,1) =100; end for n=1:ntot+1 %Boundary conditions U(...

I don't get it
 
@Amro :)
@excaza "I found this code but no working. Pls fix"
or it's a paper they're using, referring to half-step indices, which is common
 
12:07 PM
right
but he knows the problem
the solution is...don't do it
 
@Amro FYI if you type [mcve] in a comment, it expands to Minimal Complete Verifiable Example
@excaza yup...
 
oh thanks for tip :)
 
sorry, I mildly paraphrased the above example:P
 
@AndrasDeak all these years, I never knew!
 
helpful with longer comments because only the tags count towards the character limit
 
12:10 PM
yup
 
Guys, did you get to use splitapply?
 
and [mcve] is one of the few that is easy to put in a sentence
@Dev-iL 2015b
 
@AndrasDeak One of the reasons I asked
 
@Dev-iL you could do the same with accumarray
I assume, I'm still on 15b
though it looks borrowed from R (the language)
they have: apply, lapply, sapply, etc..
 
R is hip
anything hip has to be functional:P
or at least support it
 
12:14 PM
I never liked this syntax: x <- 1
ugh
 
x< -1 :P
 
no, thats assign 1 to x
as in x=1
 
I know;)
 
R in Visual Studio
they also have a similar extension for Python
 
python is meant to be developed in vim:P
 
12:18 PM
:) they've really started to embrace python and R for their Azure cloud
they have an entire infrastructure for machine learning on the cloud
according to the recent survey, we gotta start learning some R: stackoverflow.com/research/developer-survey-2016
 
interesting.. does it work with HG2?
are you using introspection with metaclass and such?
 
yes and no, just works on field names of a structure
really just a simple helper for my use :p
 
oh ok, just saw the code, its fieldnames and dynamic struct props
 
12:43 PM
@Amro Did you see the third most dreaded in that survey?
Matlab...
is the third most dreaded....
 
@kkuilla yes, unfortunately MATLAB has a bad reputation
 
I can understand it though...
 
it really comes down to the closed-source nature of it.. unlike say Python
 
I remember the first time I used Matlab at university. linspace was driving me mad and I said I would NEVER use Matlab again...
so I can understand why it is hated...
 
it does have a lot of annoying things to it
 
12:49 PM
Well, you have got the toolboxes instead.
not exactly the same though...
 
no, I mean I envy Python with the whole ecosystem around packages
 
Oh, I see. You would hang if you said liked Python more... :-)
Also, a toolbox for Matlab costs....
 
 
a fortune...
funny....
 
but seriously pip install xxx and then import xxx
we want that in MATLAB
 
12:54 PM
no more naming conflicts
actually, not true :p
 
Well, yes. That would be nice... You can do that with Octave, can't you?
I think so...
 
no not really
they still inherit the mess of path from MATLAB
they tried to emulate with pkg install and pkg load but doesnt solve scoping issue and polluting the path
 
Yes, that's what I meant. pkg... but it's not the same, no. You still have to download the package first.
and polluting the path...
 
you can't blame them, this has to be solved at the language-design level
 
and they will never re-write that...
 
12:58 PM
take Julia for instance, they designed that well
you can require packages cleanly
 
Oh, yes. I've heard of Julia. I haven't tried it but it's supposed to be really nice...
Have you tried it?
 
nothing serious no
 
Lol while writing the recursive code I found myself with:
  if all(isHopeless)
    return
  end
completely serious :D :D primitive backtracking
 
lol
 
julia has dataframes similar to python
or SQL
but julia does not have as many pre-built functions as matlab
I just use it for plotting tbh, it has some nice plotting packages...
 
1:13 PM
Why don't you plot with Matlab?
 
not presentable to businessman, they like plots with ridiculous bright colors and bars the size of chocolate bars
matlab plots are too research oriented, they cannot read
they want pie charts... I mean....they want pie
 
Oh, I see.
 
they have ggplot-like package right?
 
Pie is good. Pie charts are not...
 
there are some good plotting packages, gadfly, ggplot etc, which are really presentable, and you save them as a SVG vector file it scales nicely on html
yep, which is nice, and ofc easy to install :D
I think they integrated well with github, I don't know if they use Heroku or something, but basically new commits to the master triggers version update and the pkg is re-built and pushed
 
1:21 PM
yes the package manager is actually based on git repos, so every package you install just is basically cloning the source repo. when Pkg needs to update, it's as simple as git fetching and merging..
 
now we need this in Mathworks, people still have to write matlab code in .m files and then upload them as a zip to Mathworks...urg
although I just use git and add path and use the downloaded functions
 
the reason why the likes of node.js and Julia are pleasant to work with is that they have packages, dependencies, and a package manager that resolves, installs, and updates all of that for you..
 
Yeah but node.js ............
 
??
 
That requires some different thinking
..from me at least... all that callback-based idea
 
1:32 PM
Javascript is everywhere, you gotta catch up :) Soon we'll have a whole matlab-clone in JS :)
 
oh no... not JS
 
Matlabscript ! I reserve all rights to that name (C) :)
 
Well I'm using the excuse that I'm a mechanical engineer and therefore allowed to distance myself from "popular web technologies" :P
 
I like ruby, I can live with Java minus the JVM, I like Matlab as long as it is free to use, I accept Scala because I have to, but JS is something I cannot learn
actually, a few years back when they were talking about html5 would be the death of js, what happened?
 
html was never against js, it's just they started to include some of that functionality directly in the standard
 
1:35 PM
I read somewhere that they expect js to be everywhere. Oh, yes. Jeff Atwood. If anything can be written in js, it will...
 
yes, the Atwood Law :)
JS is assembly language for the web
 
:D and that's a good thing now?
 
its actually a thing
asm.js is an intermediate programming language designed to allow computer software written in languages such as C to be run as web applications while maintaining performance characteristics considerably better than standard JavaScript, the typical language used for such applications. asm.js consists of a strict subset of JavaScript, into which code written in statically-typed languages with manual memory management (such as C) is translated by a source-to-source compiler such as Emscripten (based on LLVM). Performance is improved by limiting language features to those amenable to ahead-of-time...
WebAssembly or wasm is an experimental efficient low-level programming language for in-browser client-side scripting, which is currently in development. Its initial aim is to support compilation from C/C++, though other source languages are also intended to be supported. WebAssembly is a portable abstract syntax tree which is designed to be faster to parse than JavaScript, as well as faster to execute. The initial implementation of WebAssembly support in browsers will be based on asm.js and PNaCl. After the minimum viable product (MVP) release, there are plans to support garbage collection which...
there's also compilers c++ to js like emscripten
 
wow
supports c and c++
 
1:40 PM
I guess this is explained in the SO developer survey, why JS is the most used + popular language amongst developers
amazing
so soon I will be able to play all my steam games on my browser :D
Port of OpenDune, an open source implementation of the classic real-time strategy game Dune II
Dune II.... good old days
 
ah I remember that
no maybe it was C&C not dune
 
this is pretty amazing, now I am not going to work, but play games on my browser
nice
 
Monkey Island, best adventure game series!
Monkey Island is the collective name given to a series of five graphic adventure games. The first four games in the series were produced and published by LucasArts, formerly known as Lucasfilm Games. The fifth installment of the franchise was developed by Telltale Games in collaboration with LucasArts. The games follow the misadventures of the hapless Guybrush Threepwood as he struggles to become the most notorious pirate in the Caribbean, defeat the plans of the evil undead pirate LeChuck and win the heart of governess Elaine Marley. Each game's plot usually involves the mysterious Monkey Island...
I remember the dialogs were hilarious
 
love this game
 
1:52 PM
how long did that take @Dev-iL :D
 
dunno exactly, safe to say >1h
But what's important is that it got me "in the zone" so now I can code some other stuff more efficiently, at least for a little while ;)
 
ah yes, the elusive "zone" :)
 
:D you mean all the for loops got you in the zone?
 
@GameOfThrows I get a great sense of accomplishment from successfully writing recursive functions :)
 
1:57 PM
Regarding that problem, I genuinely tried to come up with a BFS algorithm but ended up with a DFS
 
I like the tree search method
 
tnx for the votes, assuming it's you two :)
 
:D always appreciate a recursive function
 
2:55 PM
:3
Mornin duders
DOOM!
I wonder if I could get away with playing this at work
lol
probably not
 
DO IT
 
@Dev-iL You are rep-hunting, aren't you? :)
 
@kkuilla So that's what it is? And there I was thinking that the way to get rep was answering trivial questions on high traffic tags...
 
and posting it on a chat...
 
that's called "the meta effect" :) But honestly, the reason I posted it was because I want some help figuring out that DFS/BFS BS
 
3:08 PM
:)
 
hey @Dev-iL, now that I look at your solution it doesnt look right!
 
The recursive one probably isn't, hence the disclaimer
 
no the first one
 
How can it not be?
 
change the input to be
L = {...
    [0 1 3 5 6 7 9]
    [0 1 2 3 4]
    [5 6 7 8]
    [1 2 3 4]
    [1 5 7 8]
};
I removed 9 from the third set
it errors
 
3:10 PM
Perhaps I edited it wrong when fixing something
Let me see
 
also how come you break/return early once you find a group of sets that cover the target?
shouldnt you be testing all possible subsets?
and take the one with min length
 
nLists = numel(L);
 
@Dev-iL no I figured that, still it errors Index exceeds matrix dimensions.
 
Regarding why it should give the shortest one: it goes over all combinations of "1" sets , then 2 sets etc. If it finds something with 2 it doesn't continue to 3
 
right, that makes sense
still there's an error, can you reproduce it?
 
3:15 PM
for indC = 1: numel size(...,1)
 
ahh! thats it
hold on, another bug :)
ismember returns a vector, change it to this: if all(ismember(R,u))
right?
and you should add a last line to assign out = [] in case no solution was found
 
I did something else with the output, but for a whole different reason - only because it was annoying when not calling with ; :P
 
that will error if function called with an output and no solution found
dude, you need unit testing ;)
 
@Amro a) For sure. b) I also initialized out "by the way"... c) Thanks for letting me know about the bugs!
 
np. You know what, I ended up writing a version of my own, very similar
R = [0 1 2 3 4 5 6 7 8 9];

names = {'A' 'B' 'C' 'D' 'E'};
L = {...
    [0 1 3 5 6 7 9]
    [0 1 2 3 4]
    [5 6 7 8 9]
    [1 2 3 4]
    [1 5 7 8]
};
N = numel(L);

% powerset of L: set of all subsets (excluding empty set)
powerset = cell(1,N);
for k=1:N
    sets = nchoosek(1:N, k);
    powerset{k} = num2cell(sets,2);
end
powerset = cat(1, powerset{:});

% for each possible subset, check if it covers the target R
mask = false(size(powerset));
for i=1:numel(powerset)
    elems = unique([L{powerset{i}}]);
 
3:32 PM
I guess you should post it as an answer, and refer to item #2 in my Note(s) :P
 
I still havent looked at solution #2... you sure it's solid? :)
 
not solution 2, what I said about how it can be vectorized :)
@Amro Yeah you should probably disregard that one completely lol
 
hehe
 
4:17 PM
@Amro would you say that "tree search" algorithms, like what I claim to have implemented, are applicable to problems? Or should I publish an article now? :P
 
haha, dunno I'm no expert in combinatorics.. all I know is that those NP-hard problem are... HARD! but definitely write up that paper :)
 
BTW, I'm about to post your above solution as CW, are you ok with that?
 
oh sure, go ahead. I didnt because it was pretty similar to your brute-force method.
 
@Amro oh that question. I saw that last night. Was curious to know how to solve it
The one where you have to find the minimum amount of lists to make a complete list?
 
Yeah
 
4:26 PM
it was devil who got us interested :)
 
:D I was wondering how to do it beyond brute force.
I didn't think it was algorithmically solvable beyond brute force because it feels like it's a derivative of the subset-sum problem
which is NP-Hard.
or sorry, the Knapsack problem
 
The set cover problem is a classical question in combinatorics, computer science and complexity theory. It is one of Karp's 21 NP-complete problems shown to be NP-complete in 1972. It is a problem "whose study has led to the development of fundamental techniques for the entire field" of approximation algorithms. Given a set of elements (called the universe) and a collection of sets whose union equals the universe, the set cover problem is to identify the smallest sub-collection of whose union equals the universe. For example, consider the universe and the collection of sets . Clearly the union...
 
ohhh. aha.
Yup. NP-Complete.
 
whats the difference again? hard vs. complete?
 
I love how these new OPs think the question is simple, but it turns out to be NP-Complete.
 
4:30 PM
@rayryeng Sorry for my ignorance, but... why is that a problem?
 
@Dev-iL because as the input size grows, it becomes computationally intractable.
For this particular case, it's fine for brute force.
 
exponential in the input size
 
Ouch. Ok... So my hunch about the solution's bad scalability was not unfounded... :)
 
all you can do is brute-force or heuristics
like solving a special case of the problem, not the general one.. assuming you can find a good solution
it all comes down to P-vs-NP !
 
@Amro A lot of the times, you can solve a problem by reducing it to a different problem. If you can reduce Problem B to Problem A, givne a solution to Problem A, you can construct a solution "easily" (i.e. in polynomial time) to Problem B. If the problem is NP-Hard, you can reduce any problem from NP (Non-polynomial) to polynomial.
So if we could solve an NP Hard problem in polynomial time, then we can prove that P = NP yes.
NP-Complete is if the problem is both NP-Hard and NP.
 
4:34 PM
yes I'm starting to remember now, theory of computation classes :)
 
@Amro yeah :D... actually this post is great... I had to refer to it at some point in my discussion with you :P.. that's why it took me a while to reply
516
Q: What are the differences between NP, NP-Complete and NP-Hard?

DarthVaderWhat are the differences between NP, NP-Complete and NP-Hard? I am aware of many resources all over the web. I'd like to read your explanations, and the reason is they might be different then what's out there, or it's out there and I'm not aware.

 
@rayryeng Looks like it is too broad and should be deleted....
 
I know, but it's a good post lol. and it was before SO had all of these rules.
@Dev-iL There are many problems where we can verify that it is a solution to the problem in polynomial time, but finding the actual solution ... the timing and complexity is not known
One example is known as the subset sum problem... given a list of integers... can you find a combination of numbers where the sum is equal to 0?
If we are given the solution, we can easily verify that the sum is 0.
but if we aren't, especially if the list is large, it is not known if there is an efficient algorithm to do this without brute-force.
 
btw NP is "non-deterministic polynomial", not "non-polynomial" right?
 
yes I'm sorry.
You are right.
that's what I meant :D
@Dev-iL This is actually one of the Clay Math Institutes Million Dollar Prize problems.
It is not known if P = NP or if P != NP
And if you can prove if it is or isn't, you get $1M lol.
but the ramifications of this proof will be quite huge... especially in crytography.
If it can be proven that P = NP, many cryptographic algorithms will have to be reformulated.
because they're banking on the fact that you have to use brute force to break a key.
 
4:38 PM
go on.....
 
Also you'll be far richer in cryptocoins ;)
 
:D!!
There are a large number of NP problems... where no known efficient algorithm can solve these unless you do it by brute-force
This is a list of some of the more commonly known problems that are NP-complete when expressed as decision problems. As there are hundreds of such problems known, this list is in no way comprehensive. Many problems of this type can be found in Garey & Johnson (1979). == Graphs and hypergraphs == Graphs occur frequently in everyday applications. Examples include biological or social networks, which contain hundreds, thousands and even billions of nodes in some cases (see e.g. Facebook or LinkedIn). 1-planarity 3-dimensional matching Bipartite dimension Capacitated minimum spanning tree Rou...
Basically, the theory is that if you can solve one of these problems efficiently, you'll be able to solve all of them efficiently... all of these problems essentially are the same formulation but in different areas.
The current flux of things is that we don't know if there is such an algorithm to solve one of these problems efficiently.
Subset sum is one of those problems, but a more familiar problem is known as the Knapsack problem.
The knapsack problem or rucksack problem is a problem in combinatorial optimization: Given a set of items, each with a weight and a value, determine the number of each item to include in a collection so that the total weight is less than or equal to a given limit and the total value is as large as possible. It derives its name from the problem faced by someone who is constrained by a fixed-size knapsack and must fill it with the most valuable items. The problem often arises in resource allocation where there are financial constraints and is studied in fields such as combinatorics, computer science...
You have a knapsack that can only carry a certain amount of weight...and you have items that have a weight and an associated value.
 
Sounds familiar
 
The goal is to pack the knapsack as much as possible respecting the weight restriction of the knapsack while maximizing the total value of the knapsack
one way is to do it by brute-force... find all combinations of items and choose the one that has the most value and can pack the knapsack as much as possible.
but if there are 100s of items, the number of combinations grows exponentially and is thus intractable in calculation.
so this problem with the sets that you were looking at earlier reminded me of this
You can see that the problems are very much related... but the goals are different.
 
4:44 PM
Let's go back to the field of cryptography.. So in human words, basically you're saying that if a "smarter-than-bruteforce" algorithm is found, that for example, excludes many possibilities and thus reduces the computational complexity of the problem... it would be a big deal
 
@Dev-iL yes it would.
because the amount of keys you would need to test to break the encryption would no longer be brute force.
You would reduce the number of keys to search for.
basically the problem would boil down to which combinations of bits are required to successfully find the plaintext of the message?
Cryptographic algorithms bank on the fact that brute force is required to do this if you don't know the key
with 128-bit encryption, there are of course 2^128 possible combinations for you to try
 
Sounds to me that one will have an easier time reverse-engineering AES to find some vulnerability than doing that :)
 
:D!
 
It would probably be amazing when in not-that-many-years from now, somebody will show that you can plaintext-attack AES successfully, or any other of the unsolved computational problems we have today
 
I know eh?
That would be scary... none of our information would be safe anymore :P
@Dev-iL do you happen to know what this OP is asking?
0
Q: Display close to zero rounded value in Matlab

Pedro77How to display the rounded value of a number? Matlab seams to remember the zero signal. The signal does not make sense anymore since the value was rounded. Code sample: a = - 0.001; ar = round(a,2); fprintf('a: %.2f. a rounded: %.2f. Zero: %.2f\n', a,ar,0); result: a: -0.00. a rounded: -0...

 
4:52 PM
Oh right, because now it so safe...
 
quantum computers could do that..
 
@Amro but when... WHEN will they be available to us :(?
 
@rayryeng probably a matter of display
i.e. how do I add more digits of precision to my output
Oh, I think the problem is that the rounded value retains the sign
 
ohhh is that it?
 
@rayryeng one should be amazed at how far we've gotten just at this state..
i remember listening to an episode of dotNET-rocks podcast
the geekout ones are amazing btw
 
4:56 PM
oh?? I've never listend.
 
the geek-out episodes, you should definitely subscribe!
 
:D I will
 
filter on "Geek Out"
seriously go listen to some of them now!
 
@Amro right now :) yes.
 

« first day (274 days earlier)      last day (2947 days later) »