What are you working on?
Old thread: >>58480704
first for java
They got rid of CD/DVD. they are coming for our guns.
Reminder that syntax highlighting is for kids and faggots
>>58485295
Thank you for using an anime image
>>58485340
Thank you for using an anime image
>>58485351
>>58485295
I'm working on efficient TCP socket handling, SOCKS handling, and better Tor integration in my decentralized TV project. Audio playback is working pretty OK now, and basic encryption has been implemented (via OpenSSL). I know I shouldn't hand-roll encryption, but I'm thinking about creating a hand-written RSA function set just to make it easier to decode (not without a fair amount of warnings though).
I also made an IRC channel (#basictv on Freenode) for it, hoping I can get away from shilling it on 4chan.
Trying to learn Anglican as an alternative probabilistic programming language to PyMC which I do not find so intuitive.
>>58485400
>that gook name
not interested.
>>58485400
did somebody say anglican
Starting java - anyone know why this code is crashing? It's a program that counts vowels from a string
if you enter a string with vowels it throws:Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
at charplay.Charplay.getVowels(Charplay.java:28)
at charplay.Charplay.main(Charplay.java:11)public static char[] getVowels(String word){
char[] foundV = {};
char[] Vowels = {'a', 'e', 'i', 'o', 'u'};
char[] arg = word.toCharArray();
for (int i = 0; i < arg.length; i++){
if (Vowels[0] == arg[i]){
foundV[i] += arg[i];
}else if (Vowels[1] == arg[i]){
foundV[i] += arg[i];
}else if (Vowels[2] == arg[i]){
foundV[i] += arg[i];
}else if (Vowels[3] == arg[i]){
foundV[i] += arg[i];
}else if (Vowels[4] == arg[i]){
foundV[i] += arg[i];
}
}
return foundV;
}
>>58485435
foundV[i] doesn't exist
do this:
foundV = { 0, 0, 0, 0, 0 };
and then do an outer for loop rather than Vowels[0], Vowels[1], Vowels[2]...
>>58485435
Use a fucking switch!
>>58485435
It crashes because it's Java.
>>58485580
You mean a loop.
>>58485628
I mean a switch in a loop.
>>58485435
>char[] Vowels = {'a', 'e', 'i', 'o', 'u'};
>Vowels[0]
>Vowels[1]
>Vowels[2]
>Vowels[3]
>Vowels[4]
>>58485681
>>58485435for(int i = 0; i < arg.length; i++) {
for(int j=0; j < Vowels.length; j++) {
if(Vowels[j] == arg[i]) {
// ...
}
}
}
>>58485859
What's your problem with frog posting?
if i wanted to create a random number in c, let's say, between 5 and 25 how could i do it?
>>58485903
kill yourself before the genie kills you
>>58485920
(random() % 20) + 5
>>58485931
y tho
>>58485920
(rand() % (high - low)) + low
Anyone here ever actually used call/cc?
>>58485955
>>58485943
Modulo bias.
>>58485943
>>58485955
thanks
>>58485955
it's saying high is undeclared
>>58485967
yes, it's off by like 20 in 2 billion
>>58485988
Nice bait but you're 30 seconds too late
>>58485955
>>58486007
>>58485943
it was always giving me the same number, is it fine to add#include <time.h>and [srand(time(NULL));] or is there a better way
>>58486073
thats the only way
>>58486073
call srand once with a seed
if you use the same seed you get the same ouput
>>58486100
false
>>58486114
there's no other way
>>58486299
>it's literally impossible to do anything other than time
Developing this game
http://tiledbattle.com
>>58486332
true
>>58485295
Call me noob and whatnot
but please
can someone give me a really good reason why I should make ANYTHING private in my code?
>>58486364
!true
I'm not working on a project, but I'm working on learning how to program. I'm only a few days in so far, but it's been a fun ride; maybe I can stop being an impoverished burger flipper and be a code monkey instead...
My current plan: I'm doing the Python-based EDx 6.00.1x MIT course January-March, then following up with the 6.00.2x course March-May. I'm passively watching the 1986 MIT SICP lectures (finished 3B) with the intent to more intensely visit the lectures/book later this year when I'm more experienced; I also plan to go through K&R at an undefined timeframe. I'm going to try things like Project Euler and attempt to solve at least the basic problems in multiple languages (at this point, it would be Scheme/Racket and Python and, after K&R, C). I assume this will give me enough of a level of mixed practical and theoretical knowledge to learn whatever I need to learn for whatever I end up working with.
Any suggestions I should look into or pitfalls I should avoid? Any other preferred sites like Euler where I can semi-gameify/measure actual progress via challenges/projects? What other auxiliary concepts/tools should I learn?
>>58486389
If you are working with pajeets, its the only way to stop them fucking your shit up.
Otherwise it's basically a meme for shitty programmers with Alzheimers.
is c# different enough from java to call it "learning a new language"?
skimming through a tutorial and barely seeing any difference
>>58486389
Preventing name collisions in derived classes.
>>58486389
it's meant for software that has many developers working on it
so no, it's not your concern
>>58486490
sorry but what? explain please
how do you spaghetti up your code so hard, that names in different classes collide, just because the attributes or functions are not private?
succ 'D'
when is it time to swallow your pride and ask a colleague for help
just had an idea for something that would make it easier for storing and translating data structures in a universal format across languages. like you could download an array file from the internet, include an import in your program, and then load it in your program
>>58486568
JSON?
>>58486389
If you can enforce invariants some other way then no, not really. I guess if you wanted to hide implementation so you could change it without any problems in the rest of the code base, but usually you do that with polymorphism and not encapsulation (which are somewhat two sides of the same coin).
>>58486578
nobody ever studied Haskell to land a job
>>58486522
Well most objects have an external and internal API. For instance a rotating implementation of a queue has extra fields and methods for managing the queue, but these are implementation details that are abstracted from users of the queue structure (where you only care about enqueue, dequeue, empty?). Publicly exposing these details makes it so that subclasses of the queue have to work around the functionality that they want abstracted anyways, which can become problematic for naming as an example
What's the best programming tip you can give to someone?
>>58486621
>subclassing ever
>>58486623
leave /dpt/
>>58486623
Premature abstraction will kill your motivation
Logic setup for 22 relays and 7 transistors controlled by a raspi. Never really worked with python before but its pretty quick to pick up.
>>58486623
Don't
Is Jethro Tull good programming music?
>>58486537
>>58486621
Also, access modifiers are compile time guarantees like type systems that can statically enforce preconditions maintained in other methods of the class. Yes, you CAN program without a static type system (it should be no suprise that dynamically typed languages usually dont have access modifiers), but in those cases you can't rely as well on the computer to verify that you haven't fucked up in your program (which you inevitably will).
>>58486635
Yes, subclassing is cancer but when you allow subclassing to be a main feature of your design, you also should maintain some form of encapsulation (without necessarily going all out with redundant getters are setters)
I have a function which I'm using to invert an array:unsigned * invertKey (unsigned * keyPointer)
{
unsigned key[5], inverseKey[5];
for (unsigned counter = 0; counter < 5; counter++)
key[counter] = *(keyPointer + counter);
for (unsigned counter = 0; counter < 5; counter++)
inverseKey[key[counter]-1] = counter;
return inverseKey;
}
Problem is, the array returned immediately goes out of bounds. I store it in a new array asap:unsigned key[5] = {3, 5, 4, 1, 2};
unsigned * unPoint = invertKey(key);
unsigned inverseKey[5];
for (unsigned counter = 0; counter < 5; counter++)
inverseKey[counter] = *(unPoint + counter)+1;
It's worked fine so far, but it is plausible that the array values could become corrupted?
what am I doing wrong? I know it has got to do with the pointers but I don't understand why
>>58485295
Adding --csv argument to gawk.
>>58486755
>std::string*
for what purpose
>>58486833
Avoid namespace pollution in header files
What exactly is "C with classes"-style C++? What is done differently?
>>58486869
struct with function pointers
>>58486845
I think he means why a pointer to a string.
>>58486845
what?
i dont get what you sayin
>>58486869
They don't use the actually useful features like templates or lambdas.
Sorry for my dumb question, but can someone explain what my professor is asking me to do here? He's not responding to my emails and I'm confused for what he's asking. Is he saying he wants a program that puts a set of numbers into an array but instead of an array it's a linked list? This isn't something I've read about yet but this is already fucking me up.
>>58486869
C++ how it was meant to be used
badly
>>58486845
the error I get is that the constructor arguments dont match
>>58486905
It's a linked list using nodes allocated from an array.
>>58486924
you are passing "local" and "true" as values, not pointers
>>58486755
You're passing local as a pointer, but giving the value. Either change the function signature to the Event constructor to take a reference (&), const reference( const&) or take desc, t, and local by value (no warts) .
Who owns the data once you pass it in? Event? Or is it just going to hold a reference to the data?
>>58486755
Seriously don't ever write std::string* ever again.
Do this:struct Foo {
std::string str;
Foo (std::string s);
};
Foo::Foo (std::string s)
: str(std::move(s))
{
}
This takes the memory for the string passed as an argument (s) and moves it into the field str, so that the variable s now holds an empty string and therefore doesnt need to be cleaned up.
Usage:int main ()
{
// this makes a heap allocated string and passes in the constructor, so that foo1.str is "hello"
Foo foo1("hello");
// creates heap allocated string m
std::string m = "world";
// this copies the string m into a new space on the heap, and sends that to the constructor where it will be stored as foo2.str
Foo foo2(m);
// This is similar to the above, but does not copy m, instead moving it into the constructor such that foo3.str will be the old value of string m, and our variable m will be set to the empty string. This is useful when we know we aren't using m anymore, as it avoids unnecessarily heap allocations
Foo foo3(std::move(m));
}
>yfw this
https://github.com/wooorm/alex
>>58487023
>cripple to 'a person with a limp'
Holy moly
>>58486905
>>58486905
WHY IS THIS SHIT SO SMALL
print('Hello world!', file=myFile)
how to I get this to print to the console AND myFile?
https://syntaxdb.com/
This looks cool
>>58487146def tee (out, str):
print(str)
print(str, file=pout)
wow
>>58487079
https://github.com/wooorm/retext-equality/blob/master/rules.md
https://github.com/wooorm/retext-profanities/blob/master/rules.md
>>58487023
It doesn't have a CoC...
Oh wait, the whole thing reeks of SJW.
Complete programming noob here, often get stumped at the getting libraries to work phase of programming. Really want to make a simulation of a card game (similar to poker) which language would be simplest to do this with? On windows.
>>58487385
Haskell
>>58487000
>and therefore doesnt need to be cleaned up.
explain to me why C++ calls destructors on things that have been moved
Started learning go. What am I in for?
>>58487023
>insensitive, inconsiderate
>using "him" is insensitive
wo0t
>>58487385
Libraries on windows is a bitch.
DrRacket has a graphics lib suited for absolute beginners and it works fine on windowz.
If you're trying to use C++ I suggest you step away from the keyboard
>>58487406
fuck off
>>58487385
Download Haskell Platform and go through this https://en.wikibooks.org/wiki/Haskell
Do a console (text based) version first
>>58487385
Python? I don't know if that shit works on Windows though.
>>58487385
If it's a simulation you probably don't need a GUI. Just go with python.
>>58487461
It does, sempai.
>>58487431
Yeah thanks, I'm not trying to make a card game though just a simulation different instances of a card game (like how 10000's of random draws would interact with a players cards) but yeah I'll give Haskell a look.
>>58487461
Barely.
The Windows user should probably just use C#. I think that's like their only language over there. And F#. But they should probably use C#.
>>58487415
Because when its RAII scheme was designed they didn't realize the power of move semantics. The fact that moving an object leaves it in an uninitialized state basically means setting yourself up for null-pointer-exception kind of shit if you aren't careful, although in practice it's usually not a problem because moves are in a place where you obviously wouldn't manipulate the structure anyways. Yes, it's suboptimal, but C++ isn't Rust (and also has plenty of things over Rust in other departments).
Nevertheless, GCC should be able to see that the internal container is emptied right before the deconstructor, therefore the entire thing can be inlined which produces no code for the destructor.
>>58487160
I figured that was the easy answer. I thought it might be more clever to use file=myFile+sys.stdout but I don't think you can output to 2 files that way in and now I'm pretty sure sys.stdout doesn't work that way at all.
Thanks
>>58487511
but i mean shit like this
A is some external resource with an int or some shit
move from A to B
calls A's destructor which calls a function that externally destroys A
B is now worthless
gotta add a fucking bool on everything, can't make anything const
it's fucking hell
>>58487203
>depressed
It is depressing to see this go over their heads.
>>58487511
>>58487544
like a file handle
if you move a file handle it shouldn't close the file
>>58487544
>>58487566
When you move in C++ you are supposed to zero out (or otherwise invalidate) the original so that in particular the destructor does nothing. It's yet another addition to the C++ house of cards but that's how it works.
>>58487149
tfw no qt3.14 lisps
>>58487574
what if my data isn't so weakly typed as to have redundant states?
what if the functions called in the destructor aren't so poorly designed as to quietly fail for shitty input?
>>58487597
Then C++ spits in your face.
>>58487416
It's complete shit, but gets the job done.
>>58487149
The languages it supports is stupid.
>>58487617
C++ spits in everyone's face
>>58485435
Read the exception man.
At line 28 in Charplay.java, you go outside the bounds of an Array.
And wouldn't you know it, foundV is of length 0.
So you cannot put ANYTHING into it.
The way you're trying to solve the problem, you need to use a list. If you haven't gotten to lists at your lectures yet, you're doing the wrong thing.
>>58487149
>>58487630
https://syntaxdb.com/reference/search?utf8=%E2%9C%93&search=haskell
>>58487500
Yeah, just use python
>>58486389
It's documentation to others. It tells them that this bit is only meant for this class. You two weeks from now is another person for purposes of this.
>>58487544
Well if you implemented everything correctly then after moving A to B, A's destructor should certainly not destroy B's resource.
>>58487566
Well you can always set FILE* handlers to null, for instance this stupid implemenation I write in the comment box should prevent ever getting in a bad state.struct my_file {
FILE* fh;
// default constructor
my_file ()
: fh(nullptr)
{}
// move constructor
my_file (my_file&& f)
: fh(f.fh)
{ f.fh = nullptr; }
my_file& operator= (my_file&& f)
{
close();
fh = f.fh;
f.fh = nullptr;
return *this;
}
// disallow copy
my_file (const my_file&) = delete;
my_file& operator= (const my_file&) = delete;
// destructor
~my_file ()
{ close(); }
void close ()
{
if (fh) {
fclose(fh);
fh = nullptr;
}
}
bool open (const std::string& filename)
{
close();
if ((fh = fopen(filename.c_str(), "w"))) {
return true;
}
else
return false;
}
void write (const std::string& s)
{
if (fh) {
fwrite(...);
}
else
throw std::runtime_error(...);
}
};
Fuck manual RAII is so tedious, thank god I let C++ auto-generate 99% of my class constructors.
>>58487597
>what if my data isn't so weakly typed as to have redundant states?
too bad ;)
>what if the functions called in the destructor aren't so poorly designed as to quietly fail for shitty input?
guard them with if's after you've determined magic "uninitialized" values
>>58485295
>no anime image ever
>on the anime site
what the fuck
>>58487704
it really sucks how there isnt any anonymouse imageboard like 4chan but without the cancerous anime faggot spergs.
>>58487734
>it really sucks how there isn't an anime imageboard without anime
oh wait, you just want an imageboard that isn't based on anime
why not try reddit?
>>58487734
9gag
>>58487734
take a hike, pal
Am I retarded if I don't get how to implement an algorithm to generate permutations of length n from a string of length k?
>>58487734
>go to gay.com/tech/
>complain about homosexuality
>go to cooking.com/tech/
>complain about food memes
>go to 4chan.org/g/
>complain about Anime
template engine for php. got bored and decided to write one because i don't like the popular ones. pic related.
>>58487856
common misconception, friendo. glad to help.
>>58487946
forgot to include pic
Retarded noob here,
Why does this not work in c++?//in header.h
void setWeakness(int* weak[18]);
void setResistance(int* resist[18]);
/*
*
*/
//in header.c
void Type::setWeakness(int * resist[18])
{
typeRelation[0][] = weaknessTable[];
}
weaknessTable is in main.cpp and is a bi-dimensional array [18][18]
how can I make a uni-dimensional array = weaknessTable[0][]?
>>58487972
Go >>>/out/ if you don't like it
>>58488036
keep your animu. it's only thing that stands between you and the helium tank
>>58488079
Stay edgy
>>58488034
If typeRelation is only one-dimensional, how do you think you should declare it
>>58488107
not him, but
kys
>>58488113
typeRelation is also a bi-dimensional array [2][18]private:
int typeRelation[2][18];
>>58488123
no u
>>58488034
>>58488137
You have to loop through and copy each element individually, or you could use std::array.
>>58488137
ok, I did this nowvoid Type::setWeakness(double resistance, int index)
{
typeRelation[0][index] = resistance;
}
seems to be working
>>58488079
Keep yourself away from the anime website.
>>58487856
>gay
>food
>anime
stop projecting, you fat gay weeb
>>58488177
Thanks anon
>>58488214
I do, that's why Im here.
Must read beginner compsci books?
>>58488306
>>58488270
But it's anime website.
>>58488306
>>58486623
learn scheme
>>58488381
>But it's anime website.
this is extremely discouraging
the upper one is someone else's solution and the one below is mine
>>58488400
lol is that you and your bf?
anyone here nice enough to write me a bash script to ping google once every ~10 mins and do sudo ifconfig tun0 down && sudo ifconfig tun0 up if the ping fails?
>tfw programming
>>58488417
That's not hard to come up with at all
http://stackoverflow.com/questions/921398/exit-status-of-the-ping-command
>if ping returns 1 or 2, do x
>>58488417#!/bin/sh
while true;
do
ping google.com -c 3
if [[ $? != 0 ]];
then
ifconfig tun0 down
ifconfig tun0 up
fi
sleep 10m
done
then add ifconfig to the nopasswd group in /etc/sudoers for your user
>>58488410
It's just experience and hacking hacking hacking. You've got the taste to realise your code is pants. Just keep coding until your skills catch your taste.
>>58488509
thanks senpai
>>58488417while 1; do
ping -W 1 -c1 8.8.8.8 || {
sudo ifconfig tun0 down
sudo ifconfig tun0 up
}
done
Can I guarantee char arrays are always packed in GCC C?
>>58488509
Cron or systemd-timers. :)
>>58488576
>>58488417
add a sleep there
>>58488588
Yes.
Arrays are always tightly packed in C.
>>58488576
I like this command || { ... } style. I hadn't seen it before.
>>58488593
-W is waittime.
>>58488320
>>58488388
Thanks senpai!
>>58488611
You can combine || with && to get terse if/else:true && echo Yes || echo Nofalse && {
echo Yes
} || {
echo No
}
>>58488410
They used predefined functions to do the same stuff you did manually. So what?
>>58488611
It's pretty cool, D does something similar as long as the right operand is void
>>58488663
in lambda calculus this is just
echo (true Yes No)
echo (false Yes No)
>>58488709
With a Church encoding. Doesn't have to be in LC and LC doesn't have to represent data that way.
>>58488806
Wow, you really improved the joke! Well done!
Why do people still use SDL 1 when it hasn't been maintained in years.
>>58488895
the same reason people still use C
they're just stubborn and closed minded
>>58488895
Perhaps maintaining old SDL applications? Or perhaps just retarded...
>>58488931
Is C not being maintained wtf?
I know theres a lot of junk in the language that no body uses and methods you SHOULD NEVER use for safety but I didn't know its not being maintained?
>>58488895
If it still works fine for w/e purpose they need it for, why would they upgrade?
Why does gofmt sometimes format string concatenations asvariable+".html"but others asvariable + ".html".
Stupid thing.
>>58488410
He created a list for no reason in the sorted function.
>>58489018
If the latest version of a tool you want to use isn't fucked up in some way, why would you use outdated tech?
>>58488986
Anon, there is a new C standard every 11 years or so, and in between releases, compilers are being constantly improved. I believe what Anon was saying is that C itself is obsolete.
Is it permissible to interpret the ncurses window just as a field of rows and lines and just use it a an array of rows? At least temporarily? Like, if I wanted to draw a rectangledraw_rectangle(corner_h, corner_v, height, width) {
for(i = corner_v; i < height; i++) {
for(j = corner_h; j < width; j++) {
if (i == (corner_v || corner_v+height - 1) || j == (corner_h || corner_h+width-1))
put_character('#', window_cursor[i][j]);
}
}
}
Sorry for the pseudocode, but I hope the idea is understood.
>>58489097
>If the latest version of a tool you want to use isn't fucked up in some way, why would you use outdated tech?
There's a non-zero cost to upgrading anything - often very significant cost if you have a bunch of tools integrated with the current version.
SDL 1 -> SDL 2 is a major api/abi breaking upgrade.
>>58489097
Is it actually obsolete from an objective standpoint? Is society moving towards a multiparadigm language scheme for commerical use?
Are there any p2p libraries ready to use? I don't know the mechanics behind p2p and would probably fuck it up if I tried to build that part but I have an idea for building something on top of a p2p library/ecosystem.
I've tried with ipfs but it's Javascript and HTML. I'd prefer something with python.
Just the hability to connect and use hashes to request data and a daemon that serves data to other peers based on the hash they request.
>>58489153
Right, which is why I had suggested earlier that a reason to use SDL 1 would be maintaining older applications. But regardless, as I see things, unless there is a major API/ABI break in the upgrade, there is no reason not to do so. That is to say, I do not believe one should ask, "why upgrade?" but instead, "why not upgrade?"
Many upgrades to libraries and tools are mostly backwards compatible with previous versions, and the cost of upgrading is either zero or close to zero.
>>58489326
Not at all. C is nice for developing low level system libraries that interface with tons of different languages. It also has a nicety of making it easy to keep things simple when you need to focus on the metal, and not on some higher level abstraction.
That doesn't stop people from calling it obsolete, however.
Why haven't you learned Haskell?
>>58489554
because it's esoteric
>>58489510
I see, by the way, why is the C library not cleaned up? In a lot of programming books I see things that should never be used as told by other people, for example, I believe scanf is a big no-no and the use of goto should be avoided, there are plenty of other examples out there but why are so many unsafe things available still? or will it be cleaned up in the next reboot in 11 years or so like you said
>>58489573
>why HAVEN'T you learned Haskell
>>58489576
>why is the C library not cleaned up
Backwards compatibility. That said, there have been slight improvements. The gets function is gone in C11, replaced with gets_s. The scanf function is fine as long as you use length specifiers. goto is a language feature, not a part of the standard library, and it's fine to use in certain circumstances. The language is full of so called "unsafe" things because that's the fucking point of using C. You do not have a sandbox. C is what you use when you want complete control, and need to be able to touch any arbitrary memory address without the language checking in and asking you, "are you really, REALLY sure you want to do that?"
>>58489639
>C is what you use when you want complete control, and need to be able to touch any arbitrary memory address without the language checking in and asking you, "are you really, REALLY sure you want to do that?"
This is true, but honestly, how many C users are in this situation?
https://hastebin.com/acapeluwof.rb
I'm getting:/home/jett/DROP/Dropbox/Srces/projects/sparrow/nebula.rb:59: syntax error, unexpected keyword_end, expecting end-of-input
But I can't seem to find why its telling me that? I checked liked 12323 times and can't seem to tell whats going on
>>58489639
ty ty luuby-chan
>>58488663
Nice. i think I'll just stick to things like ping || { die }
>>58489719
I'm bored
any good anime suggestions?
>>58489782
What have you seen?
Im a really tough critic when it comes to anime, you can guarantee anything on my list thats 7+ is good
www.myanimelist.net/animelist/00039010
>>58489718
Not a ton. A number of C programs could reasonably be rewritten in C++ or Rust without too much of a performance drop.
>>58489718
This is what your program looks like, properly indented, with a comment after each end telling you where it matches to.class Savedb
def makepost
metas = Dir["*torrent"]
paper = File.new("2000-01-01-HOLY.md", "w")
paper << "<table><tr><th>Name</th><th>hash</th><th> </th></tr>\n"
metas.each do |metafile|
getmeta = `btshowmetainfo #{metafile}`
infohashe = getmeta.match(/info hash\.{5}: (.+)/)
@title = getmeta.match(/ (.+)/)
@link = "magnet:?xt=urn:btih:#{infohashe.to_s.sub(/info hash.....: /, "")}&tr=http://beacon.inkykinky.net:9292/announce"
paper << "<tr> <td>#{@title.to_s.sub(/\s+\(.*?\)$/, "")}</td> <td>#{@link}</td></tr>\n"
end # metas.each do
paper << "</tr></table>"
end # def makepost
end # class Savedb
def printit
metas = Dir["*torrent"]
metas.each do |metafile|
getmeta = `btshowmetainfo #{metafile}`
infohashe = getmeta.match(/info hash\.{5}: (.+)/)
@title = getmeta.match(/ (.+)/)
@link = "magnet:?xt=urn:btih:#{infohashe.to_s.sub(/info hash.....: /, "")}&tr=http://beacon.inkykinky.net:9292/announce"
print paper << "<tr> <td>#{@title.to_s.sub(/\s+\(.*?\)$/, "")}</td> <td>#{@link}</td></tr>\n"
end # metas.each do
end # def printit
end # <--- Stray end (ERROR)
>>58489827
thanks
>>58489782
Naruto
What's the one true parallel programming paradigm?
>>58485295
https://chrome.google.com/webstore/detail/you-collector/jfhhfgoagepfnfpnidfhhlneifhmieip
>>58489917
pure FP
referential transparency so everything can be parallelised
>>58489955
No that's bullshit. Haskell does a piss poor job of parallelizing anything
>>58489782
hara hara nuki
don't read the manga, go straight to the animation
>>58489983
you are right, but >>58489955 is also partly right. You need 2 things for really true everywhere paralellism. Pure functions to operate indepently and regular data structures, that reify the optimal branching of work. RePa is a partial answer to the last in haskell, yet too little work fits in the intersection of the two domains
>>58489990
>google hara hara nuki
>literally no relevant results
>>58490013
you just got a virus mate ;)
googling hara hara nuki is a trick going on since the past few days where hackers trick people into googling it
>>58489554
I don't have a cute skirt to go with it
>>58490037
you don't need a cute skirt, but it might help
>>58489782
>>58489827
>>58489883
>>58489990
>>58490013
Please don't actually discuss anime in these threads.
There is a difference between posting reaction images and post shit which actually belongs on /a/.
>>58489827
Also, fuck off with your MAL shit.
>>58490045
alright MOM thanks MOM
>>58490045
:^) oops
[spoiler]im not even sorry[/spoiler]
An RTS-MMO-roguelike
>>58490082
hai hai
>>58489917
Pure FP, but obviously using mutation and other effects where you need them, just being formal about it. I don't mean Haskell, I mean as a frame of mind.
A language where it's easy to run code on the GPU (it's already pretty easy to run code on different threads and other CPUs on a network) would be a nice addition.
>>58489935
>Unders
>>58490045
>Also, fuck off with your MAL shit
>>58490111
R is alright for statistics, VBA and Excel are gross. What kind of fucking data do you need to manipulate anyways?
Started learning x86_64 assembly. Last time I attempted it years I couldn't into operating systems. This time stuff makes a lot more sense..section .data
msg: .ascii "Hello, world!\n"
.section .text
.globl _start
_start:
movq $1, %rax
movq $1, %rdi
movq $msg, %rsi
movq $14, %rdx
syscall
_exit:
movq $60, %rax
xorq %rdi, %rdi
syscall
>>58490116
What?
>>58485435using System;
using System.Linq;
public class Test
{
public static void Main()
{
var str = "this is a test string";
var vowels = "aeiou";
var result = str.Where(c => vowels.Contains(c)).ToArray();
Console.WriteLine(result);
}
}
this is why c# > java. pajeet btfo.
>>58490163
pls use Intel syntax, it won't rape your eyes
Does anyone know how authentication works with UNC's and winapi directory shit? Like does CreateFile automatically pass the NTLM hash of the current user? Or does it assume the lowest privilege level
>>58490242
The main reason I'm working through this is so I can more easily read objdump and gcc outputs. They use AT&T, so I might as well get used to it.
If I were to write large amounts of it, I would be programming for the netwide assembler.
>>58490210
but java has lambdas too
>>58490210
>>58490289
Can someone explain the whole thing about lambadas actually being delegates and shit? how the fuck do those things werk. Just dont get it goys
>>58490163
Don't use 64-bit instructions when loading 32-bit immediates. The 32-bit versions will zero extend, and they take up less space in the instruction cache.
>>58490310
"Delegate" is just C#'s word for a (first class) function.
>>58490327
Whats a first class function ?
>>58490310
I just know that java has lambda expressions
I don't actually know why they're useful
>>58490342
A function that is better than you, you fucking third-class frogposter scum.
>>58490141
I'm sorry I missclicked this thread and made that post in here, dear /g/entooman.
Right now I want to have a study spreadsheet, something very simple. Is using R for this like using a nuclear bomb to kill a cockroach?
>>58490342
A function that can be passed around as a value. Function pointers are generally not considered first class functions, though, since they only work with functions that aren't closures.
>>58490314
How do I specify 64bit immediate values? Also, what is a good resource for learning assembly that DOESN'T suck? They all leave stuff like this out, and I'm not masochistic enough to read the Intel manuals for this.
>>58490368
oh nvm. You're not talking about correctness, you're talking about optimizations.
>>58490368
There's Step-By-Step Assembly, though it's only for 32-bit
>>58490352
dont be mean plz
>>58490360
What do you specifically mean by functions that can be passed around as values? generally, a function has a return type so couldn't you pass around functions either way since they would return something?
>>58490368
get IDA and look at how MSVC/GCC/clang optimize code to figure out how things are done properly
>>58490398
"first class" means that functions aren't very different from other values and can be treated as regular data
>>58490398
Yeah, you can pass them around as values but then you can call them. Just like how you can pass around objects and call methods on them.
>>58490398
>dont be mean plz
>Typing like a child
There are standards here, you know.
Go back to /r9k/, reddit, or whatever cancerous shithole you came from.
>>58490452
>>58490412
>>58490413
Then how do they differentiate from regular functions?
For example:def funct_1:
print("function 1")
return 1
def func_2(value):
print("function 2")
return 1+value
func_2(func_1())
couldn't you do this anyway?
I dont get it
>>58485295
>What are you working on?
sadpanda api integration in emacs
>>58490512
>>58490368
If you name a 64-bit register (rax), you're moving a 64-bit immediate, and the instruction has to be prefixed with a byte saying "do this as 64-bit", even if the immediate is encoded in 32 bits.
If you name a 32-bit register (eax), you're moving a 32-bit immediate, sign/zero extended when it gets shoved in there.
Here is a difference between the two instructions:0: 48 c7 c0 01 00 00 00 mov rax,0x1
7: b8 01 00 00 00 mov eax,0x1
>>58490563
Ohh I see, I guess I didn't really understand that cause I've never used or seen it in practice like that
Can you give me a simple trivial example of something like that? Just so I can get comfortable with it
>>58489510
>That is to say, I do not believe one should ask, "why upgrade?" but instead, "why not upgrade?"
There's always a cost (just having to setup the new version is one, however minor).
So the question is always: If things are working fine right now, why change anything?
>>58490590
i don't actually know python
anyway in FP you do it all over the place
>>58490593
>If things are working fine right now, why change anything?
New features.
Bug/security fixes.
Compatibility with new technologies.
>>58490593
Performance improvements
Security improvements
Improvements in ease of use of the library/tool
Newer features
If there wasn't an improvement in the newer version, why would it be released?
>>58487149
>No results found for continuations in scheme
>>58490616
Oh ok, what programming languages are FP and how can you even tell?
So today I implemented a play queue
Soon the player will be pretty useful
>>58490629
>New features.
Nothing you need.
>Bug/security fixes.
With new bugs introduced.
>Compatibility with new technologies.
Again nothing you need.
That was the assumption.
>>58490568
Yes, I get it. I was thrown off because you said "32-bit immediate", when the immediate could be represented by 8-bits. So "why 32?" was a natural question. So my immediate thought was that it was somehow implicit to how the number was written.
But with a tiny bit of googling I found out that only 32-bit instructions implicitly zero the top 32 of the 64-bit register.
>>58490663
haskell is FP
ocaml is FP
>>58490637
>If there wasn't an improvement in the newer version, why would it be released?
A lot of programmers enjoy adding stuff just for the sake of adding it - this is especially true in open source projects made by hobbyist.
There's nothing necesserily wrong with that, but it also implies that a newer version doesn't necesserily have anything to do with objectively better code or improvements either.
>>58490666
A player based on youtube? Really nice, I wanted to do that myself but extracting audio from a youtube page is pretty fucky because of how it's delivered, last time I checked
>>58490669
>Nothing you need.
You never know.
>With new bugs introduced.
Such is software development.
Do you really not fix any bugs in your programs because you might introduce other bugs?
>Again nothing you need.
I recently played a game on Steam (for Linux) that happened to ship a somewhat old version of SDL2.
I was using an Xbox One controller to try and play this game, and it wasn't showing up, but my old but damaged Xbox 360 controller worked.
Fortunately it was dynamically linked, so I just removed the shipped SDL file and symlinked it to my system's copy.
Now the controller worked.
Sure wasn't useful or something that I needed.
Atom or Brackets
Notepad++ or Sublime
Vim or Emacs
>>58490666
What language was this developed in? How is everything so nice? like the buttons, menu scheme and such, I don't know any programming language that has a beautiful gui wtf
>>58490736
You have to use an obscure api called get_video_info
Then you decode and parse the obfuscated strings youtube returns to obtain a list of available formats. Every format has a corresponding URL leading you to the stream. There are video and audio formats, so you can actually stream audio only, which is what I'm doing.
After I implement basic music player functionality, I'm going to add other sources, such as bandcamp, soundcloud, and maybe even spotify.
>>58490771
This is Electron, which lets you use HTML + CSS to develop desktop programs. I'm using Bootstrap as a starting point but heavily customize all elements. For symbols and icons I'm using FontAwesome.
>>58490742
>You never know.
Of course you know - you look at the new features and see if there's anything you care about (and only if it's too much hassle to implement it yourself).
>Do you really not fix any bugs in your programs because you might introduce other bugs?
Point was that it's not necessarily a good argument.
And not every bug is equal, there are many you can live with either because you never exercise that part of the library in the first place, or it's simply not a big deal with possibly an easy ad-hoc work-around
>I recently played a game on Steam (for Linux) that happened to ship a somewhat old version of SDL2.
>Fortunately it was dynamically linked, so I just removed the shipped SDL file and symlinked it to my system's copy.
>Now the controller worked.
>Sure wasn't useful or something that I needed.
You are indeed fortunate it worked at all.
>>58490700
>purity (no side effects)
I don't like this definition. A referentially transparent function has no side effects; a pure function is one that takes related inputs to related outputs for all relations. Of course, you should strive for a function to be both pure and referentially transparent so you can reap the benefits of both but neither is necessary for the other.
For example, a function that writes to standard output can be pure but not referentially transparent. A function that reads a temperature probe can be referentially transparent but not pure.
>>58490836
>Of course you know - you look at the new features and see if there's anything you care about
I was talking about the general case. You can't write off everything that isn't already part of existing libraries as useless, like you have been doing.
>You are indeed fortunate it worked at all.
Libraries that are expected to be taken seriously are backwards compatible with versions of the same major release.
Are you the kind of idiot who insists on using C89 for new code, even when there is absolutely no reason to?
>>58490666
>>58490823
How's the boot time?
Atom's was painfully slow the last time I tried it.
>>58490700
Jesus fuck, is that my post? You missed off the 'functional language is a poorly defined term' intro, which is the most important part.
>>58490700
>>58490912
One thing that benefits from functions being both pure and referentially transparent, of course, is that they can participate in constant folding. If it's not pure, you'll be inlining the value that reflects it being called at the time of compilation and not when the code is run. If it's not referentially transparent, you'll be throwing away the side effect.
>>58490952
too late now :^)
>>58491015
Don't I know it.
>>58490769
Vim.
Working on character recognition software. We have neural network to recognize characters but not a way to convert page of characters into multiple files of characters. Working on this now (image segmentation).
Takes .png of a scanned document of handwritten words. Creates an image of each character written therein. It has a couple of bugs but WIP still.
Video related: https://www.youtube.com/watch?v=p1Fi0f1L3HQ
PS: I'm using an old Thinkpad x120e to do this one since I can't commit my home PC to Linux. It runs crazy slow.
>>58491123
This is one of the coolest things I've ever seen
>>58490930
I'm using Atom to develop it and it still starts up a couple of seconds, but Emacs (with spacemacs) is slower.
The player itself loads very quickly though, there isn't too much crap weighing it down.
>>58490095
But I'm still not sure how I'll generate the map.
>>58491123
That's pretty dank. Maybe you can synthesize the text to audio using https://www.youtube.com/watch?v=5kc-bhOOLxE
>>58490590
Say you want to double each element in a listlist(map(lambda x: 2*x, [1, 2, 3, 4])) # == [2, 4, 6, 8]
>>58491355
>lambda x: 2*x
disgraceful
>>58491355
Ohh I see, is there any pros/cons comparing it to a list comprehension? Or is it the fact that list comprehensions are in fact lambdas in disguise for the use of simplicity?
>>58491415
list comprehensions are one of many things you can do with them
>>58491387
In Haskell, this is just (2*)
>>58491428
SUPER PRETTY!!!!! brb printing out some Haskell code to masturbate onto.
>>58491415
Certain situations might be better suited to using higher-order functions, though you could probably always do it both ways. It's not really something there's a rule of thumb for.
>>58491459
after that print off a piece of paper with a picture of your waifu on it to cry into
>>58491459
Take photos.
which functional language should i learn lads?
>>58491501
Lisp maybe
>>58491355
python really does have shitty syntax, holy shit.
>>58491501
scheme :)
>>58491504
(((((((((((((((((already crossed off the list))))))))))))))))))))))))
Another pretty common use in Python is with functions like "max" or "sort" which take shit like "cmp" and "key" that are functions. Convenient if you want to find the max of some list of objects by some metric other than the one implicitly specified by any overloaded __le__, __ge__, etc methods.
>>58491501
cubical
>>58491501
Haskell is the definitive FP lang
>>58491531
There's really nothing else in league with it?
>>58491549
not if you like static types and being able to use + for integers, floats, doubles etc
>>58491549
Not if your standards of excellence for programming languages are the ability to naval gaze indefinitely without actually making anything useful.
test code
>>58491576
No programs are useful.
Programming is a useless occupation.
>>58491583
I can understand how it must seem that way to someone who posts on /dpt/ too often.
>>58491583
>occupation
>haskell
>>58485435length . filter (`elem` "aeiou")
>>58491616
Like clockwork.
I remember somebody proposing a while ago that using non-ASCII symbols as operators for a made up programming language was a good idea. Is it just me, or is this idea completely retarded?
>>58491622
Hilariously terse Haskell solutions to problems posed in other languages are one of /g/'s finest memes.
>>58491631
As long as it's easy to type them I don't see a problem.
>>58491622
in Haskell there's a function called isJust
>>58487149
>>58491640
At least that one is clearly legible and even somebody who doesn't know Haskell could discern its purpose.
For shitposting, I prefer the ridiculous Haskell solutions that are deliberately convoluted
>>58491631
>>58491631
"Let's make all programming as if it was visual basic"
>>58491651
>For shitposting, I prefer the ridiculous Haskell solutions that are deliberately convoluted
Oh good, because I write those, too.
>>58491642
I'm afraid people are going to be putting way too much complexity in one line to be readable, it also relies on having font support for a ton of unique and niche characters
>>58491653
have mercy
>>58491651{-# LANGUAGE RebindableSyntax #-}
(>>) = ...
>>58491664
It's the only way TO write Haskell.
public class ANONHAXZ {
if 4chan = ! hack IP, run iTunes.exe
else System.out.println("2+2=" + x);
Just showing off my code, yeah, I know I'm a epic hacker.
>>58488388
Is that actually entry level or are you goofing me? That sounds highly unassuming and convoluted
>>58491123
This is really cool. Is it using machine learning?
Post code?
New thread:
>>58491695
>>58491695
>>58491695
>>58491504
Lisp is not a functional language, but you can write functional code.
http://letoverlambda.com/index.cl/guest/chap5.html#sec_1
>>58491517
Those parenthesis are not balanced.
Learning vim today
>>58488034
Is this fucking pokemon?