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

/dpt/ - Dziennego Programowania Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 322
Thread images: 37

File: M1DPSs7.gif (122KB, 320x240px) Image search: [Google]
M1DPSs7.gif
122KB, 320x240px
Na czym pracujesz, /g/?

Stary thread: >>57834252
>>
>>57838637
English motherfucker, do you speak it?
>>
>>57838637
Motherfucker english, speak it do you?
>>
>>57838637
Thanks for proving that translation engines are still complete garbage. Both the title and the sentence are grammatically wrong.
>>
>>57838637
First for Java
>>
>>57838637
Où est la bibliothèque?
>>
>>57838637
how do hashmaps work in java? i thought i'd just be able to do
LinkedList<T> RemoveDups(LinkedList<T> input){
HashMap<T> occurrence = new HashMap<T>();
...
}

but it's telling me the hash map requires two type parameters, which the documentation says is one for the key and one for the value. what does this mean? the value would be <T> if i'm not wrong, but what would the key be?
>>
potato
>>
>>57838714
T would be your key. Your value could be anything, you don't really need to care -- all you care about in your case is whether it's in the map or not. So you can use the smallest possible available type (maybe char or boolean or somesuch.)
>>
>>57838714
it depends. a hashmap is used to map a value to a key.
>>
File: gsfight.webm (3MB, 720x405px) Image search: [Google]
gsfight.webm
3MB, 720x405px
/dpt/-chan, daisuki~

Ask your much beloved programming literate anything (r/IAMA).
>>
>>57838774
How do I get my programming teacher to suck my dick?
>>
>>57838774
Why didn't you reply to anybody?
>>
File: osw_anachan.webm (3MB, 1372x756px) Image search: [Google]
osw_anachan.webm
3MB, 1372x756px
have you done anything productive, /g/?

post progress
>>
Can I set a function pointer as 0 in C?
If so, will it reset my computer?
>>
>>57838774
anime is garbage
>>
>>57838749
Thanks. I hope Google will give me job in American that is good enough to support my village by this
>>
>>57838685
Write a correct version that involves three words with initial D, P and T.
>>
File: ready_to_kill.png (176KB, 560x530px) Image search: [Google]
ready_to_kill.png
176KB, 560x530px
Is anyone doing Advent of Code 2016?

>>57838808
pic
>>
>>57838803
There's no reason why a function pointer couldn't be NULL (as a matter of fact, if you declare a global array of function pointers, all its elements should be initialized to NULL automatically if not initialized explicitly).
>>
>>57838832
Advent of Code IS SHIT

STOP SPAMMING
>>
I can see why C# exists after using C++/MFC, but C# doesn't have any dank themes by default.

what do?
>>
>>57838796
>>
>>57838829
Dzienny Programerski Topik
>>
>>57838853
I forgot to add.
Set to 0 (NULL and 0 aren't the same, are they?) and then call this function.
Is it possible?
>>
File: 1476906394694078432.jpg (53KB, 480x360px) Image search: [Google]
1476906394694078432.jpg
53KB, 480x360px
>>
>>57838874
Programerski?
But English name is Daily Programming Thread, not Daily Programmers' Thread.
>>
>>57838880
you are guaranteed to end up with a nullpointer if you cast the number 0 to a pointer-type. But the nullpointer is not guaranteed to be all zero bits (so e.g. if you initialize a pointer with calloc(), memset() or whatever to zero, you are not guaranteed to end up with a nullpointer.)

If you call a nullpointer, your program will simply segfault.
>>
>>57838829
Daily Programming Thread
>>
nepracujem nič :/
>>
File: loli_forcing_her_way.webm (966KB, 1280x720px) Image search: [Google]
loli_forcing_her_way.webm
966KB, 1280x720px
>>57838880
yes but most OSs set the (virtual) memory region from 0x0 to ~0x1000 as non-readable, non-writable, and non-executable to detect array accesses on a null pointer.
>>
>>57838908
I'm not polish but that sounds right in another slavic language.
it's an adjective.
>>
>>57838857
stop being so upset
>>
So I'm applying for master's programs in comp sci and I'm beginning the process of learning all the programming and math skills that I need so that I can hit the ground running (my bachelor's degree wasn't in STEM).

My question is, what if I don't get into a program? Is there any way I can use those skills to get a job or will employers just throw my resume in the trash without having a proper CS education? Basically I don't have a back up plan and that scares me.
>>
File: 1434300238001.png (74KB, 562x795px) Image search: [Google]
1434300238001.png
74KB, 562x795px
tak było
>>
>>57838774
How come you haven't killed you are self yet?
>>
>>57838880
You should specify what language you're talking about (in C, NULL is a preprocessor constant standing for (void *)0). Dereferencing NULL pointers has its usual implications, I believe that function pointers wouldn't be any different. You should make sure that the pointer in question is not NULL before actually calling via that pointer.
>>
nie zdałem kolosa z C eeeeeeh anoni
>>
File: 145082842445889606.jpg (78KB, 480x511px) Image search: [Google]
145082842445889606.jpg
78KB, 480x511px
>>
>>57838880
>NULL and 0 aren't the same, are they?
It's complicated. It depends on the context.
NULL is defined to 0, but a pointer can be 0 without being NULL, and sometimes 0 means NULL but sometimes it doesn't.
>>
>>57838925
Is there a possibility to overcome this?

>>57838983
C
>>
>>57838908
Polish grammar makes it impossible to reconcile both conditions. The ordering of the words is simply different.
>>
File: 1434301091001.gif (380KB, 388x358px) Image search: [Google]
1434301091001.gif
380KB, 388x358px
>>
>>57838829

Dzienny Programistyczny Temat.
>>
>>57838926
I know that's an adjective, but doesn't programer means literally a programmer?
>>57839018
I thought word order in Polish is free.
>>
File: peach.webm (3MB, 848x480px) Image search: [Google]
peach.webm
3MB, 848x480px
>>57839014
Yes, by using the OS's API to make the said region executable and writable, then you write some machine code there.
>>
What are some of the more portable GCC extensions? I know inline assembly, for example, is also supported by TCC, but what other sorts of extensions are supported outside of GCC?
>>
>>57838829
>involves three words with initial D
GAS GAS GAS
>>
>>57839048
You aren't the usual literate
>>
File: 1434302571001.jpg (41KB, 1077x528px) Image search: [Google]
1434302571001.jpg
41KB, 1077x528px
>>
why is java so shit? i can't handle this. if interviewers don't want to let me use haskell they can fuck off
>>
>>57838908
As a last resort you could go ahead and swap "Programerski" for "Programistyczny", but that sounds a bit over the top.
>>
File: 394px-129358863582.jpg (47KB, 394x600px) Image search: [Google]
394px-129358863582.jpg
47KB, 394x600px
POLAND STRONG 40:1
>>
>>57839051
#pragma once

clang has full support of GNU C
>>
File: 140283117684.png (167KB, 250x170px) Image search: [Google]
140283117684.png
167KB, 250x170px
>>
File: 1478108559116754603.jpg (14KB, 241x357px) Image search: [Google]
1478108559116754603.jpg
14KB, 241x357px
>>
>>57839065
How about Clojure?
It uses JVM and yet it's a functional programming language.
>>
>apply for programming job
>go to interview
>get hired
>have no idea what the fuck im supposed to be doing at said job
im kinda scared, first day sometime next week
>>
>>57839113
What's your job is called?
>>
>>57839108
>It uses JVM and yet it's a functional programming language
Maybe in the paradigm sense, but nothing using JVM actually functions
>>
>>57839108
i'll look into it. i don't want to bring an arcane language into coding interviews that interviewers have never heard of or can't read the code of, but i really can't handle java. if i can have a middle ground of something that is mainstream but also powerful and high level that's what i'd want
>>
File: potato.webm (324KB, 496x339px) Image search: [Google]
potato.webm
324KB, 496x339px
>>57838796
Spent the whole day working on a Harvest moon clone.
>>
>>57838956
If you can program, you are in demand. But to land a good position, you'll still need to have a portfolio to show off and maybe a niche you're specialized in (e.g. app development or web development)
>>
>>57839130
kek
>>
>>57839129
quality assurance technician
>>
>>57839148
nigga, you're awesome
Everyday a new game, that's something.
>>
>>57839148
Looks like a dwarf fortress remake.
>>
>>57839166
not me

>>57839129
just "C# developer"
i was told they make desktop applications and i know they're in the healthcare industry, not much more than that
>>
cheeky breeky kurwa
>>
>>57839221
iv damke
>>
>English daily thread
>taken over by poles
damn it, not again
>>
does anyone have the /g/ challenge list?
>>
>>57839248

Poles are the european niggers
>>
WILNO JEST POLSKIE
>>
>>57839219
>and i know they're in the healthcare industry,
Hope your code won't cause anyone's death.
>>
>>57839113
>this man is getting hired while you're unemployable
>>
>>57839299
>Hope your code won't cause anyone's death.

Well, we need to solve overpopulation somehow
>>
>>57839317
It's more abut who you know and knowing how to present yourself. Actual talent or skill does not matter.
>>
>>57839172
Nah, the last two were 15-30 minute mini projects.
Been working on this one for 5-ish hours straight, and it'll probably take a day or two until version 1.0, so my 1:1 game/day ratio ends here...
Thanks for the support tho!

>>57839178
Yeah, I went with roguelike-based mechanics, since, ya know, ncurses.
>>
>>57839334
>implying that isn't its own skill
>>
what's a language that's good for working with data structures? ie graphs, trees, etc
>>
>>57839355
It doesn't take any skill. It's literally being in the right place at the right time. If your parents or friends work in the industry you don't even have to try.
>>
>>57839317
>you're hired while some bitter 4chan fatass is jealous
yep, feels pretty good
>>
>>57839370
C++

but really, most language can deal. It depends on how much you care about overhead and being able to model the structure you want precisely.
>>
>>57839370
Java holds your hand more than C++ for data structures. I'd use it for that purpose.

Python if you want to be quick.
>>
>>57839374
>fatass
nice try but i'm no american
>>
>>57839048
Anime was a mistake
>>
>>57839416
>Python if you want to have it written quick
FTFY
>>
>>57839370
Any language, but some languages are better suited to specific types of structures. For example, LISP is very good at handling lists and, notably, even expresses programs in lists than can be modified as a data structure.

For really getting into the nitty gritty, C is a very strong contender - manual management of every byte is possible, and pointers are very powerful tools.

Java is a very well understood language that is used by many universities and such, so there's also a lot of material out there for algorithms+data structures that uses Java, so it is also another worthwhile contender.
>>
>>57839455
What about Haskell?
>>
File: umaruchristmas.jpg (216KB, 850x1232px) Image search: [Google]
umaruchristmas.jpg
216KB, 850x1232px
>>57839434
Please don't say that. Japanime/Manga is one of the few things which give youngsters the desire to live and fight for this (sad) world.
>>
File: test5+test6.jpg (18KB, 144x288px) Image search: [Google]
test5+test6.jpg
18KB, 144x288px
The one on the right looks like way clearer, right?
>>
>>57839476

I like image processing. What's the technique?
>>
>>57839509

I'm teaching a neural network to visualize images on demand
>>
>>57839473
anime gives me the desire to live and fight for a different world
>>
poles are literally the niggers of europe
>>
I want to make a PC from NES, what should I keep in mind in order to do it efficiently?
>>
>>57839469
Haskell by definition can't manipulate structures, they're immutable, but this alone is an interesting twist and there's a shedload of value in learning Haskell for how functionally rigorous it is and how different it is from imperative languages like C(++)/Java/Python.

Haskell cares more about types, and programs are built by transforming between types and combining data. You can still implement a lot of the same algorithms and data structures but just in different ways.
>>
>>57839370
J might be a fun choice, if you have prior programming experience.
>>
>>57839584
though haskell does have pointers in the IO monad and references in the ST monad
>>
>>57839545

1. Criminals
2. Dirty
3. Uneducated
4. Invade and ruin everything

It'sa match!
>>
>>57839526

I hate neural network fags. They have forever ruined classical image processing!
>>
>>57839724
I hope you're using comonads for your classical image processing
>>
>>57839724

If you can't beat us, join us.
>>
>>57839724
>I hate progress
Looking forward to your funeral!
>>
File: nani.png (304KB, 722x768px) Image search: [Google]
nani.png
304KB, 722x768px
Can someone tell me what I'm doing wrong with my day 1 AoC problem?

#define sq(n) ((n) * (n))
#define distance(a, b) sqrt(sq(b.x - a.x) + sq(b.y - a.y))

struct point {
int x;
int y;
enum { NORTH, EAST, SOUTH, WEST } dir;
};

int main(void)
{
char *ins = get_filebuffer("input.txt");
struct point orig = { 0 };
struct point pt = { 0 };
char *tok = strtok(ins, " ,");
while (tok != NULL)
{
char dir;
int dist;
sscanf(tok, "%c%d", &dir, &dist);
switch (dir)
{
case 'L': pt.dir = (pt.dir == NORTH) ? WEST : pt.dir - 1; break;
case 'R': pt.dir = (pt.dir == WEST) ? NORTH : pt.dir + 1; break;
}
switch (pt.dir)
{
case NORTH: pt.y += dist; break;
case EAST: pt.x += dist; break;
case SOUTH: pt.y -= dist; break;
case WEST: pt.x -= dist; break;
}
tok = strtok(NULL, " ,");
}
printf("Coords: X: %d Y: %d Dist: %.3f\n", pt.x, pt.y, distance(orig, pt));
}
>>
>>57839002
co na nim było?
jaka szkoła?
>>57838637
question for ameribros.
does polish really sounds that weird for you?

>pytanie dla amerykańskich braci.
>czy język polski naprawdę brzmi dla was tak dziwnie?
>>
>>57839724

I hate myself too, I have to retrain it every time I want to change some weight or add another image, which takes like 45 minutes each time, fucking cancer.
>>
>>57839801
>does polish really sounds that weird for you?
I can't even read how that is supposed to sound. When I hear it spoken though it's pretty weird.
>>
>>57839794
First of all, use a debugger and some common sense.
Second of all, that rotation mechanism seems kinda wonky, idk if enums loop back once you go below 0.
>>
>>57839801

I can tell you as a Russibro, It looks and sounds like shit.
>>
>>57839801
As a serb, I'll just say that the combination of a slavic language and the latin-ish alphabet make it seem like a horrid mess.
>>
>>57839864
Privet, hule are you here instead of a shithole such as Harkach?
>>
>>57839858
>>57839794
Oh wait nevermind, I was overthinking it.
The site just wanted the total number of blocks added together and not the shortest distance from 0,0.

Also, the rotation works fine, I already tested it.
>>
>>57839894

Because I live in a western country?
>>
>>57839894
>shithole
that's why.
>>
what do I need to start programming phyton? im a total programming illiterate
>>
>>57838714
hashmap maps key to value. you want a hashset which just stores keys
>>
>>57840119
A book and a computer. What do you think you'd need?
>>
>>57839724
sad!
>>
>>57840136
a 120+ IQ
>>
>>57840162
>Python
>120+ IQ
Pick none. IQ is a bad metric anyways.
>>
>>57840119
Python will make you even worse at programming
>>
>>57840119
The python interpreter and a text editor. What operating system do you use?

ignore the dankmemers
>>
>>57840204
>anyone who disrespects python is just meming
ok ranjeet
>>
>>57838973
>>57839004
>>57839025
>>57839268
Ból dupy szwaba, żryj gówno.
>>
>>57840241
i am referring to >>57840181(you)

if somebody doesnt know how to program computers then learning a computer programming language cannot possibly make them worse at programming computers than they already are.
>>
>>57840276
Yes it can. Python teaches you all the wrong things.
>>
>>57840276
Can agree with >>57840290.
Python can and probably will make you disregard proper technique.
Back when I was starting out, I made a simple browser in python, got full of myself, ignored proper algorithms for it, etc.
Looked over the codebase a few months ago, it was a horrid mess of lists, hash tables, and other really high-level things...
>>
>>57840290
At least it's not Javascript
>>
>>57839740
>>57839749
>>57839771
>>57839811
>>57840157

I was only pretending. :^)
>>
>>57840119
You can start here
https://docs.python.org/3/tutorial/
>>
>>57840372
There is exceedingly little difference

Except, you know, there's no __init__ in Js
>>
>>57840405
Python doesn't have the clinically retarded typesystem and implicit conversions of JS.
>>
Go clean a toilet Slavshit
>>
File: no problems.png (11KB, 477x181px) Image search: [Google]
no problems.png
11KB, 477x181px
>>57840420
>>
>>57840204
Windows.
i also have Ubuntu but I barely use it
i was recommended phyton because (I was told) it goes well with my field (physics and math)
also I just want to have fun programming. im not getting deep into CS at all
>>
how do i export for example an array of strings to html in c#?
>>
>>57840455
Well, to be fair, python is much more strongly typed than javascript. And while it's all dynamic (which sucks) I think most people will agree that that's a good thing, at least.
>>
>>57840504
Python is shit and you should be ashamed
>>
>>57840504
Python is more strongly typed than a lot of other languages, such as Java or C#
>>
>>57840500
for (var s in myarray) {
os.writeLine ("<p>{0}</p>", HtmlEncode (s));
}
>>
Have an object "plupdate" like so
var plupdate = {}; 
var pl = "profit";
plupdate[pl] = preturn.toFixed(2);

But when I try to use it in my mongodb update query
collection.update(query, {$set: plupdate}

I get the error message $set is empty. You must specify a field like so: {set: {<field>: ...}}. console.log(plupdate[pl]) returns the value I expect, so I don't understand why I get the error. Any ideas?
>>
What's the deal with those noSQL things?
>>
>>57840519
For what?

>>57840534
I thing stronger = better, but OTOH, a shekel at compile-time is worth a thousand dollaridoos at runtime, so while python is better than javascript, lua et al in my book, it is still strictly inferior to any statically typed language (also e.g. typescript)
>>
https://www.youtube.com/watch?v=SWTWkYbcWU0&t=4m21s

RUBY ON SUICIDE WATCH
>>
>>57840619
they are things with no sql, not only sql or no, sql!

what do you want to know tho
>>
>>57840690
>what do you want to know tho

What are they for?
Are they better?, faster?
or are they just sidegrade dbs?
>>
W końcu zrobiłeś, huh, blet?
>>
Why is my class for drawing a rectangle in a window so much slower than the implemented one. I'm using c++/Visual Studios. My functions uses setPixel() to draw a filled rectangle but it's somehow much slower than the fillRect() class. What tricks do they use?
>>
>>57840535
thanks it was enough help although i could get HtmlEncode to work.

did it like this
        public static void ExportHTML(string[] a)
{
System.IO.StreamWriter file = new System.IO.StreamWriter("list.html");
file.WriteLine("<!DOCTYPE html>");
file.WriteLine("<html>");
file.WriteLine("<body>");
foreach (var s in a)
{
file.WriteLine("<p>{0}</p>", s);
}
file.WriteLine("</body>");
file.WriteLine("</html>");
file.Close();
}
>>
>>57840765
>My functions uses setPixel() to draw a filled rectangle but it's somehow much slower
No shit it's much slower.
You're doing a function call for each pixel. fillRect() is doing a memset on a buffer.
>>
>>57840765
Not using SetPixel for one, that's a function call (and god knows that it has to do beside just writing to memory) for every pixel.
A fast FillRect function will get everything setup (potentially lock/map the pixel data, etc) so it can just write to a pointer which is incremented by one for every line and then increment by the width for every row.
And for even faster you then optimize this to do multiple pixel writes per step using simd if available.
>>
>>57840765
>What tricks do they use?
lots of tricks. also, setpixel is slow.
>>
I'm so close.

99*:00"tupni"i$$>v  ;stack has number of lines left on top;
<v @k!`0: < +-10
> & & & 74p54p34p 74g54g+34g v
A B C C + B > A `
!
^ _ 34g54g+74g v
A + B > C `
!
^ _ 34g74g+54g v
A + C > B `
!
^ _ ;triangle checks out; 046*g1+:48*-.a,046*p
> 046*g48*-.a,@
run like so:
$ cfunge advent03.bf < input
it requires that the input file be named "input"
as well as that the input file be redirected in on stdin

"works" right now but I'd like to get rid of the '.a,' on line 12
and instead just ouput once the count once at the end on line 13
to do this I should just need to change the '.a,' on line 12 to a '$',
and change the '@' on line 2 to a 'v'. this doesn't work for some reason
>>
>>57840740
there are a lot of tradeoffs with databases. look up the CAP theorem.

Basically the different databases make different choices wrt what combination of C, A and P they want to focus on, and what kind of data they want to be made for.

document-oriented databases are about storing and manipulating documents, e.g. in the case of couchdb/mongo/etc they can be arbitrarily nested JSON documents

wide column databases (bigtable, cassandra etc) focus on storing data with very wide (but hopefully mostly sparse) columns

key-value stores (mnesia, memcached/memcachedb, riak) focus on just storing key-value pairs. Some like mnesia, berkeleydb etc focus on being actual stores, memcached and riak for instance have particular focus on being used for caching

appendlogs/streams like kafka and eventstore focus on being, well, eventlogs, that is, append-only streams of data that consumers can subscribe to (this type of database together with event-sourcing and CQRS is becoming really popular lately)

Most of these databases can replicate across many instances, some do so with eventual consistency, some provide better guarantees. Some databases have really low focus on consistency, and in turn usually get much better performance. They may not even support e.g. transactions. Some focus more on availability, etc.
>>
Just finished making my game and its editor use zlib to compress/decompress modules. It's yielded a space saving of around two thirds on the little test module I've been using.

Of course, it necessitated rewriting all my I/O code that previously used fread/fwrite.
>>
>>57840817
>>57840824
thx
>>
>>57840900
have a look at physfs
>>
>>57840930
Looks useful, I'll check it out for my next engine. Thanks!
>>
Interesting programming problem i might have to solve soon.

So imagine a game where you can trade items for money. Players decide the value of the trade.
The game tracks all trades so you have complete history available.
Each trade has a set of multiple items and a price they were traded at.
Is it possible to get the median/average value of each separate item from this data?
Or at least upper and lower bound or a even a statistical distribution of the price for each item?
With such data you could "suggest" a price for any future trades, or even calculate stuff like who's the best trader.
>>
>>57841120
If you have an estimate for the price of your 3 objects A, B and C, and the 3 sold at (A+B+C)*1.2, then you can estimate that each object was sold 20% higher than your current estimate, and use that to adjust it.
>>
i'm going to make my own haskell graph module, with blackjack and hookers
>>
>>57841181
use comonads
>>
>>57841168
Oh so this is basically an N-dimensional optimization problem where N is total amount of unique items in game.
This could work i suppose, climb until you can't climb anymore. And i doubt there's local maximums.

What about getting a statistical distribution of the price for each item? Or an upper/lower bound?
>>
>>57838658
w-w-what ?
>>
>>57839476
>Simon fucking Pegg
why
>>
>>57840841
there we go, time for part 2
99*:00"tupni"i$$>v  ;stack has number of lines left on top;
<v vk!`0: < +-10
> & & & 74p54p34p 74g54g+34g v
A B C C + B > A `
!
^ _ 34g54g+74g v
A + B > C `
!
^ _ 34g74g+54g v
A + C > B `
!
^ _ ;triangle checks out; 046*g1+046*p
> 046*g48*-.a,@
run like so:
$ cfunge advent03.bf < input
it requires that the input file be named "input"
as well as that the input file be redirected in on stdin
>>
File: ?.png (7KB, 120x120px) Image search: [Google]
?.png
7KB, 120x120px
what is it better between these?

A: enter work at 7.00 AM and leave at 4.00 PM
B: enter work at 8.00 AM and leave at 5.00 PM
C: enter work at 9.00 AM and leave at 6.00 PM
>>
>>57839801
do napisania programik, uj
>>
>>57842198
9 to 5 is what everyone agreed upon.
>>
>>57838637
>Na czym pracujesz, /g/?
I'm lifting heavy ass sit and putting it down again
>>
>>57842281
Shit*
>>
is there a faster way to do this?
function mostFrequentWord(words) {
var wordAmount = {};
for (var i = 0; i <= words.length; i++) {
if (words[i] in wordAmount) {
wordAmount[words[i]]++;
} else {
wordAmount[words[i]] = 1;
}
}
return wordAmount;
}
>>
>>57842367
You can't make the algorithm more efficient since it's already O(n), so all that's left is optimizing it.

See if you can improve the implementation, and if you really care about performance, rewrite it in a systems language like Sepples.
>>
"Let's make an API where people can access their game input devices in all kinds of way and also make way for advanced force feedback and other cool stuff!"

- Microsoft

"Let's overcomplicate a simple thing by making all kinds of bullshit around it for which you do not need shit and let's absolutely NOT document how this shit works or is to be used!"

- Also Microsoft

"You know what that shit was too complicated let's only give support for the Xbox 360 controller also fuck force feedback and push DirectInput into legacy life support!"

- Also Microsoft

"Oh fuck people still play sims and shit I guess we're stuck now, hey you guys using wheels and joysticks use the old API also figure it out yourself idek"

- Also Microsoft

"Oh fuck how does this shit work I just wanna make games lets just not support wheel in Forza Apex"

- Also Microsoft

"Ghahahaha people are upset let's implement some sort of force feedback using vendor APIs instead of upgrading XInput or simplifying DirectInput"

- Also Microsoft

"Wow fuck this DirectInput shit I'm gonna use not C++ and just use this cool lib"

- Everybody indie/hobby

Fucking hell
>>
>>57841681
part 2 was easy after figuring out part 1.

99*:00"tupni"i$$>v  ;stack has number of lines left on top;
<v < v k!`0: < +-30
> & & & 73p53p33p & & & 75p55p35p & & & 77p 57p 37p v
A B C v` g33+g73g53 < D + G > A
^ < !
D E F v _ 33g35g+37g v
A + D > G `
G H I !
v _ 33g37g+35g v
A + G > D `
!
v;quit code here; _ ;triangle checks out; 076*g1+076*p
> 076*g48*-.a,@
> 53g55g+57gv
B + E > H `
!
v _ 55g57g+53gv
E + H > B `
!
v _ 53g57g+55gv
B + H > E `
!
v _ ;triangle checks out; 076*g1+076*p
> 73g75g+77gv
C + F > I `
!
v _ 75g77g+73gv
F + I > C `
!
v _ 73g77g+75gv
C + I > F `
!
^ < _ ;triangle checks out; 076*g1+076*p


run like so:
$ cfunge advent03b.bf < input
it requires that the input file be named "input"
as well as that the input file be redirected in on stdin
>>
>>57842198
7-4
>>
>>57842420
>You can't make the algorithm more efficient since it's already O(n),
Sure you can. Two things can be O(n), and one could still be a hundred times faster than the other.
>>
>>57842464
Xinput was a mistake
>>
>he thought it was the stack
derp
>>
>>57838658
this
>>
how do you get a feel for acceptable speeds when coding shit?
like, if i measure i get a result that says "22.419 microseconds" which really doesn't tell me fuck all because i dont know how long that is compared to other operations
>>
>>57842522
>>57842420
Also, I want to add to what I said.
That algorithm is NOT O(n).
>if (words[i] in wordAmount) {
Is clearly not an O(1) operation.
I don't know how JS implements this, but at best it's O(log n). However, it's more likely that it's O(n), as there are no assumptions about the input being sorted.
His algorithm is probably O(n^2).
>>
>>57842589
Get a sense for how long operations take.

Adding two integers will take ~1ns, accessing something from disk takes ~1ms, etc. When you profile a function, if you know what operations are being performed you can estimate its running time.
>>
write a program that calls you a whore every 10 seconds
>>
Polygon rotation and transformation.
Rolling for something more interesting.
>>
>>57842627
import time
while True:
print ("Whore!")
time.sleep(10)
>>
File: roll.webm (389KB, 800x400px) Image search: [Google]
roll.webm
389KB, 800x400px
>>57842639
Forgot this.
>>
>>57842646
is this doable in common lisp?
>>
>>57842675
that's python

dont really know CL, but it should be something like this:
(loop (
write-line "Whore!"
(sleep 10) => NIL
)
)
>>
>>57842675
(loop
(print "Whore!")
(sleep 10))
>>
>>57842731
is this solution >>57842712 wrong?
>>
>>57842599
>However, it's more likely that it's O(n),
I know JS is shit, but surely it's not /that/ shit.
>>
>>57842627
while sleep 10; do echo "Whore!"; done
>>
>>57842751
yes. => doesn't do that. write-line "Whore!" should have parens around it.
>>
File: lk.jpg (202KB, 1920x1080px) Image search: [Google]
lk.jpg
202KB, 1920x1080px
What does /dpt/ think of this guy?
>>
>>57842772
>fast code is not important
>get 10 fps on a 2D game
>>
>>57842599
Why is hashmap lookup not an O(1) operation in your opinion?
>>
>>57842772
Don't know and don't care who they are, but they couldn't look more autistic.
>>
>>57842794
>they
thanks for not assuming their gender
>>
where do you get non-meme randomness?
>>
>>57842786
Oh right, it's a fucking hash table.
I thought it was an array, because of JS's syntax.
>>
File: 435.jpg (93KB, 800x450px) Image search: [Google]
435.jpg
93KB, 800x450px
>>57842794
Don't be so mean.
>>
>>57842784
This post brought to you by the department of taking things out of context and retorting to a single frame of a youtube video
>>
>>57842842
Why don't they just call it "lambda" FFS
>>
is haskell a meme?
serious answers only.

what isn't a meme?
>>
File: 78.jpg (55KB, 640x480px) Image search: [Google]
78.jpg
55KB, 640x480px
I think he's pretty comfy desu.
>>
>>57842826
Use random.org
>>
>>57842876
who?

>>57842874
it's great
>>
>>57842865
Anonymous function is clearer
>>
File: 87.jpg (36KB, 640x480px) Image search: [Google]
87.jpg
36KB, 640x480px
>>57842889
The guy in the pic.
>>
>>57842865
Because that would be on the border of "wrong" and "unhelpful"
>>
i'm thinking of how to do graphs in haskell. right now i'm thinking of having the graph be a list of vertices, which are all lists of what other vertices the vertex connects to.

e.g.
[[2,3],[1,3],[1,2]] would be a complete triangle. the index in the list is what number the vertex is, and the length of the list is how many vertices there are.

how would i go about marking off visited vertices like this though, when i'm doing a search through the graph?
>>
>>57842896
"Arrow function" is still not "anonymous function"

>>57842899
How so?
>>
>>57842918
just Data.Graph
stop reinventing the wheel
, that is, if you understand graphs fundamentally
>>
What are JavaScript generator functions used for, lads?
>>
(sometimes
(all you (want (in life)))
(is (a 'close-paren)))
>>
>>57842918
In this case a vertex can implicitly be identified by its position in the list, so you can store the visited nodes by number in a Set or similar.
>>
Can someone post the dumb little crow with the knife? I'm bored.
>>
photobucket has this function where if you try to load a direct link to an image, it instead loads the parent page with information about the photo. quite often happens when a GIS result links to a photobucket file, or the image is hotlinked on a forum or what have you.

do you know of a back/frontend implementation where I can use something like this? what is the feature called? It seems a bit less trivial than your standard js redirect, because the user didn't try loading a page with javascript contained in it- they just requested an image file.
>>
>>57842918
An adjacency matrix is another possible implementation.
>>
>>57842935
i looked at data.graph and stronglyConnComp was plastered all over it. i don't understand what that is. it also doesn't have examples on how to use any of the things it talks about in it, and LYAH doesn't have anything on it either

so i figured i'd just make something myself, which of course i'd know how to use
>>
>>57842874
it's a neat language, but it won't help you stop being a NEET, that's for sure.
>>
>>57842960
ah yeah, just have it be another parameter, separate. was spinning my wheels on incorporating it into the graph, thanks
>>
>>57842627
#include <stdio.h>
#include <signal.h>
#include <time.h>

volatile sig_atomic_t should_print;

static void sigalrm_handler(int num)
{
(void)num;
should_print = 1;
}

int main(void)
{
struct sigaction sa = {
.sa_handler = sigalrm_handler,
.sa_flags = SA_RESTART,
};

sigemptyset(&sa.sa_mask);
if (sigaction(SIGALRM, &sa, NULL) == -1) {
perror("sigaction");
return 1;
}

struct sigevent se = {
.sigev_notify = SIGEV_SIGNAL,
.sigev_signo = SIGALRM,
};

timer_t timer;
if (timer_create(CLOCK_REALTIME, &se, &timer) == -1) {
perror("timer_create");
return 1;
}

struct itimerspec ts = {
.it_interval = {
.tv_sec = 10,
},
.it_value = ts.it_interval,
};

if (timer_settime(timer, 0, &ts, NULL) == -1) {
perror("timer_settime");
return 1;
}

while (1) {
if (should_print) {
puts("Whore");
should_print = 0;
}
}
}


>>57842646
>>57842712
>>57842731
>>57842765
It's like you don't even want to be accurate.
>>
>>57842992
rather than a set you should consider an unboxed vector
>>
>>57843010
i dont know what that is nigger
>>
>>57843024
are you stupid
>>
>>57843009
my CPU is left hanging at 50% every 10 seconds with your shitty code

you're supposed to print a message and then sleep for 10 seconds while on a infinite loop
>>
>>57843075
No: I used a spin-lock on purpose.
Gotta be accurate.
>>
File: 1479552443257.jpg (52KB, 1024x768px) Image search: [Google]
1479552443257.jpg
52KB, 1024x768px
Is it possible to train a deep maxout neural net without using dropout? I can't get it to converge properly and I'm not sure what I'm doing wrong. I'm trying to get it to learn XOR, but it only works for one or two out of the four different cases
>>
>>57842926
ES5 already supports "function (x) { return x+1; }"
ES6 supports an equivalent syntax "x => x=1".

"Arrow function" refers only to the latter.
>>
>>57842627
define second
>>
>>57843201
one quintillion attoseconds.
>>
alright fags, post your salaries
>18,4$ an hour working as a webfaggot
>>
>>57843258
>18,4$
Go home, europoor.
>>
>>57842974
seriously, what the fuck does this mean?

graphFromEdges :: Ord key => [(node, key, [key])] -> (Graph, Vertex -> (node, key, [key]), key -> Maybe Vertex)
Source

Build a graph from a list of nodes uniquely identified by keys, with a list of keys of nodes this node should have edges to. The out-list may contain keys that don't correspond to nodes of the graph; they are ignored.

can they not include an example of how to use it?
>>
>>57843258
$35.39/hour as backend developer (C++, postgres, go)

due soon for a raise tho
>>
>>57843268
thats before tax, its actually 12,25$
>>
>>57843306
I was also pointing out your stupid way of writing currency. It's completely wrong.
You can do whatever the fuck you want in your own language, but when using English on an English-speaking anime messageboard, use the proper format.
>>
>>57843268
>$
He's probably South/Central American.
>>
File: 1478608314279.jpg (52KB, 500x500px) Image search: [Google]
1478608314279.jpg
52KB, 500x500px
>>57843338
kek, fucking fight me
>>
>>57843253
define attosecond
>>
>>57843428
tree fiddy
>>
>>57843428
1 quadrillionth of one millisecond
>>
define define
>>
>>57843201
wait a second and i'll tell you
>>
>>57843201
1/3600 of the time it takes for the earth to complete a rotation.
>>
>>57843481
fuck am i reading
>>
Fuck this motherfucker in particular.
https://youtu.be/PqU_ot4BlNQ?t=2337
This is why I hate the C++ committee more than anything.
They're most certainly forking C++. Just unofficially. If you go to pick up a C++ book it teaches you the entire set. Barely touches real world usage. You simply can't get educated in the act of programming in the language without working with it. It renders any new C++ programmers next to useless and they've shifted blame of the dialects/'philosophies' that spring forth to employers or individual programmers. If you want high performance C++ programmers you won't find it because there's so many programmers who think the language is fast just because you use it. And the teaching of the language doesn't ever allow you to distinguish the two without through testing. In the case of C programmers they all care about some form of performance. Or they wouldn't be using C (in general).
It's a copout and a sign of a community that aims to please everyone as poorly as possible.
>>
>>57843567
Sometimes I wish Bjarne would ACTUALLY fork C++ with all the FP ideas he's been learning but then I realise Bjarne would fuck it up
>>
>>57843567
wtf are you on about
>>
>>57842897
who?
>>
>>57842863
>out of context
I kinda doubt he's really saying anything else if he's teaching haskell in connection to this.
But it's difficult to find the link to this guy.
Because he's teaching a _USELESS_ language.
>>
>>57843567
can you post a time stamp? I'm not very interesting in these people.
>>
>>57843835
I did.
t=2337
>>
>>57843567
Jesus them niggers seem smart.

The reason it doesn't tocuh real world usage is becuase smart people wrote the book and assume people will just get it and understand how itcan be implemented.
>>
>>57843889
>tfw to smart to teach people how to use our language.
>>
>>57843850
right. The embedded video didn't take me to the right place.
>>
File: file.png (131KB, 613x191px) Image search: [Google]
file.png
131KB, 613x191px
Is seriously doubt /g/dpt is smart enough to beat this game
>>
>>57844077
Have you seen the new game from Zachtronics?
>>
>>57844077
I need to get back to it. I got about 90% through during early access and haven't gotten back to it since Zach changed some puzzles. Same with SHENZHEN I/O except more like 75% and I'm just grinding freecell when I play now
>>
I want to make a language tutorial, is it necessary to make a video with talking commentary, or will people's ADHD kick in without it?
>>
>>57844354
don't do a video or at least do text alongside video. video is an awful format for study and learning.
>>
>>57844354
Video is good for more general dissertations on the programming craft. Like conferences and the like. For learning, especially at a beginner's level, the key elements are allowing the learner to proceed at his own pace, and providing a level of interactivity that lets him play with concepts and ideas. Videos provide neither of those...
>>
>>57844077
Every time I play a Zachtronics game I get about 2 or 3 hours in before I think that I really should just be programming instead of play mock programming.
>>
>>57844370
I wanted to do video with text on the side, more or less a slide show. I think audio commentary is painfully boring.

>>57844430
What do you suggest.
>>
>>57844444
noice digits m80

make me want 2 throw sum shrimp on the barbie
>>
>>57844567
tiger prawns mate
>>
>>57843889
I'm actually racist enough to be surprised at the black guy who's asking question is literate.

It feels bad because I don't want to be but this world made me like this.

He's handsome though.
>>
>>57844960
>literate
Eloquent.
>tfw dumb racist white girl
>>
>>57844960
it's a culture thing
>>
>>57844354
Videos always get more exposure unless it's top tier content.
If it's top tier content I'd rather have it in well written text.
If it's not well written text audio and or video is better.
>>
File: 1414364266995.jpg (38KB, 350x234px) Image search: [Google]
1414364266995.jpg
38KB, 350x234px
>>57843128
pls halp
>>
>>57842876
how the f#ck can a person be comfy?!
>>
File: ERBCLq.jpg (76KB, 640x480px) Image search: [Google]
ERBCLq.jpg
76KB, 640x480px
>project due today
>requires encrypting messages passed between a server and a client
>have it done yesterday
>want to make a video to demonstrate how it works
>up to this point I've done all my work on a Gentoo installation
>it's been working fine
>install a Linux VM on Windows because already have some recording software setup on Windows
>test out the program on said VM
>starts throwing an error
This
I didn't ask for this
>>
>>57845448
>done all my work on a Gentoo installation
You deserve what you got
>>
>>57842712
You don't write parentheses in Lisp like in C.
>>
>>57845448
>fell for the gentoo meme
>>
>>57845448
Uhm, why can't you install OBS and QEMU on Gentoo and do it proper way?
>>
Well?

>>57845588
>>
>>57838637
First for Object Oriented Programming being a fucking blight on humanity. (no exceptions)
>>
>>57845588
I guess because the philosophy of phyton is that there should be only one clear way of doing it? so you already have if-elseif-else
not sure though, i dont write in phyton
>>
Javascript noob here. How do I declare the returned number of an external javascript function a variable in HTML?
>>
>>57845639
Most OO systems have exceptions though
>>
>>57845678
not only do you have if/else if/else, you can also use dictionaries to make something like a switch statement.
>>
>>57843258
$54 / hr assuming an 8 hour workday, or $62 / hr assuming a more realistic 7 hour workday. Factoring in stock and signing bonus just over $103 / hr. New grad. Feels weird making more than my parents straight out of school...
>>
>>57845624
I figured it'd be quicker on Windows since I mostly had everything setup, but now it's looking like I'll have to do that
>>57845466
I fail to see how this is Gentoo's fault
>>
>>57845775
>I fail to see how this is Gentoo's fault
It's YOUR fault
>>
>>57845788
?
>>
>>57845684
let variable = doSomething()


???
>>
>>57845797
You chose to only test your program on a fucking meme nobody OS
>>
What's stopping computers from going faster?
>>
>>57845873
Memory speed mostly. The computations are really quick, but a computer will spend most of its time looking up things in RAM.
>>
>>57845873
They aren't trying hard enough
>>
>>57845873
Lack of legs
>>
>>57845873

In terms of clock speed... heat.
In terms of general performance... memory and I/O bandwidth.
>>
>>57845613
gentoo is simply the best distro out there.
it can hardly be called a "meme"
>>
>>57845915
*nobody fucking uses gentoo
it can hardly be called a "meme"
>>
>>57845915
gentoo is simply the best meme out there.
it can hardly be called a ''distro''
>>
>>57845922
but i do and that other anon does
>>57845924
that's not how it works.
the best distro can't be a meme by definition
>>
File: 1425261967412.png (39KB, 245x419px) Image search: [Google]
1425261967412.png
39KB, 245x419px
>>57845922
>>57845924
>>
>>57845768

Silicon Valley? Feels a tad bad, I got 90K and just started my job last week. It's not a horrible salary but it's not on the high end either like you.

Not really much regret but I am assuming that because the job involves C++, that I will go insane sooner than later.
>>
>>57845958
It's a Silicon Valley company but I'll be at a satellite office with nowhere near the cost of living. And less than an hour from my hometown.

I got super lucky with bonuses since I had a lot of leverage too.

>>college is worth it
>>
>>57846041

That's nice. I lived in Ohio so couldn't do much for myself over there career wise.

But yeah, the cost of living in SV sucks a lot. At least the work is still interesting.
>>
>doing all of advent of code in C
>decide I'm really gonna get on the leaderboard this time
>text editor open, boilerplate set up, ready to snipe the answer
>needs me to do an MD5 of a string

Fucking hell, I can't find a library that quick. All the pythonbabies have probably already sniped the top spots. Guess I have to wait for tomorrow.
>>
>>57843481
>seconds defined with time
>time defined with seconds
really makes you think
>>
>>57846272

If you want to program fast, C is not a language you would want to use.
>>
watching people learn to program on youtube is pretty interesting
>>
>>57846272
this guy is number 2

this is 2015:
https://github.com/petertseng/adventofcode-hs/tree/master/bin
>>
>>57846317
I'm pretty quick with it. It's really not hard, I've been able to get the last few done in around 15 minutes in imperfect situations. (not having text editor / terminal / boilerplate code ready, being on my laptop instead of my laptop) I really thought I was gonna get it this time. I'll probably just go to bed and do it in the morning at this rate.

>>57846347
Haskell is pretty easy to do stuff like this in though, anon.
>>
>>57846365
*laptop instead of desktop
fuck, I can't type.
>>
>>57846365
>Haskell is pretty easy to do stuff like this in though, anon.
Then why aren't you using it?
>>
File: 1480631850738.png (37KB, 300x289px) Image search: [Google]
1480631850738.png
37KB, 300x289px
>>57846399
>he always takes the easy route through life.
I dunno man, maybe I want to better my skills at something. Just 'cause it's easier to be a fat piece of shit and never exercise doesn't mean you should.
>>
File: 1414236412536.png (28KB, 383x400px) Image search: [Google]
1414236412536.png
28KB, 383x400px
>>57846437
>haskell being hard to use and generally bad is a feature
I bet you run arch too
>>
>>57846437
but Haskell is a good way to better your skills, you stupid fucking good for nothing wojak posting robot
Go back to your containment board.
>>
File: 1480631507465.png (26KB, 293x389px) Image search: [Google]
1480631507465.png
26KB, 293x389px
>>57846467
I never said I liked Haskell anon, and I also never said it was hard. You may need to work on your reading comprehension.

>>57846477
I know how to code in Haskell. I want to be more proficient in C. As a personal challenge, I am forcing myself to complete these programming problems in it.
>>
New thread:
>>57846534
>>57846534
>>57846534
>>
>>57845894
That's what
Is keeping most programs from being faster.
Diespace and heat is the issue now.
Memory being slow is a Diespace issue.

We could have non-modular ram in pc's. I dunno how much that'd help.
>>
test
test
>>
>>57838637
Jestem mechatronikiem, w czym mogę się nauczyć programować? Jaki program polecacie?
Thread posts: 322
Thread images: 37


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.