[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/ - Daily Programming 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: 313
Thread images: 30

File: dpt_flat.png (102KB, 1000x1071px) Image search: [Google]
dpt_flat.png
102KB, 1000x1071px
Old thread: >>59275068

What are you working on /g/?
>>
File: 1487694804658.jpg (517KB, 1521x1076px) Image search: [Google]
1487694804658.jpg
517KB, 1521x1076px
FizzBuzz
>>
Give me a small language that runs on JVM or CLR
>>
>>59280552
C as in Christ
>>
>>59280628
C as in Communism
>>
>>59280639
C as in Cock
>>
>>59280617
rembulan lua
>>
>>59280661
C is for Cucks
>>
Lisp seems like a lot of fun to program in, with such an elegant implementation of lists and recursion, but the rest of the syntax is kind of fucking annoying. I wish there was more syntactic sugar as an alternative to parens for things besides lists. It's a huge barrier for me to remember how to order all the statements with such minimal/reused syntax while learning the real, actually interesting challenges of programming in it. Are there any dialects that have more syntactic sugar for me to start with until I'm comfortable enough to the original syntax?
>>
>>59280703
Even in that case you are still dealing with 3 separate arrays of value. How do you plan on merging such data? Gaussian?
>>
I remember a project of a better libc that /g/ was making a couple years ago. What happened to it?
>>
>>59280727
i'm not sure what you mean. i'm simply claiming that there are equivalent AoS representations for the SoA representations you're talking about. the values are heterogeneous regardless
>>
Doing java homework :(
>>
>>59280552
Is this one good?
https://www.amazon.com/C-How-Program-Paul-Deitel/dp/013299044X
>>
What's the best backend framework to connect an Android app to an external NoSQL DB?
>>
>>59281068
>not just using sqlite
hipster code artisan pls
>>
Say I had a scene in a videogame and I wanted to do a more proper render of it.
Would it be possible to capture all the VBOs and opengl calls to replicate it so I can change shaders etc?
>>
What defines a real programmer?
>>
>>59280726
Google "Common Lisp Reader Macros" and make your own syntactic sugar.

Hashtables are a common place to start. I HATE writing (make-hash-table ...) (setf (gethash....)) stuff.
But after a reader macro, it's much easier.

Here's a decent starting point:
https://gist.github.com/chaitanyagupta/9324402

Let's you type JSON into lisp and get hashtables back out. I'm certain you can make your own easy-to-use reader macros for other stuff.

Also, remember that arrays are #("elements" "in" "the" "array").
>>
>>59280552
my goal is to acquire currency, what's the best way of going about that with programming?
>>
>>59280552
I had a job interview yesterday and they told me they'll probably switch to angular JS.

How is angular js ? Any experience ?
I'm used to code in C, C++, javascript, php if that matters
>>
>>59281233
Thank you, this is just the kind of thing I'm looking for.
>>
Why do people say functional programming is more scalable than OOP? It seems like in a lot of cases, expanding the scope of a project requires rewriting a lot of code if it's written functionally.
>>
>>59281187
The ability to sit down and lose yourself in the joy of programming for hours :'3
>>
>>59281241

get a job
>>
>>59281094
How is SQLite going to help if something needs to be stored offsite?
>>
File: 895.jpg (41KB, 554x439px) Image search: [Google]
895.jpg
41KB, 554x439px
>learn Haskell
>post it as a skill on LinkedIn
>have to get a 2nd phone line installed because recruiters are calling 24/7/365 offering 6-figure jobs now
>>
>>59281187
>What defines a real programmer?
If you'd rather spend 2 hours automating a task than 1 hour doing it manually,
you're a real programmer.
>>
tfw you can program functionally in c# and it's way more fun than default c#
>>
>>59281068

What do you mean? You want to poll a website for some DB to present to your user?

Just use a http request and send a JSON DTO, and on server-side use whatever you're comfortable with (php or whatever) to consume the request and update db as required
>>
Should I take an offer for a company that pays shit and looks dreadful to work for, but it'll be an actual developer position, or should I keep looking for somewhere I'll want to stay at for more than 6 months?
>>
>>59281656
Depends on how urgently you need money.
>>
>>59281656

never take a job that doesn't suit you unless you really need the money/exposure/experience/whatever.

You can get the same cred as a developer by hacking open source
>>
>>59281666
Well, satan, I don't particularly need a job ASAP, but I'm worried that if I don't take something soon it'll start to look bad since I graduated last year.
>>
Self learner in c# here, need help with this problem (doesn't need to be in c# tho)

We are given 5 integer numbers. Write a program that finds those subsets whose sum is 0. Examples:
- If we are given the numbers {3, -2, 1, 1, 8}, the sum of -2, 1 and 1 is 0.
- If we are given the numbers {3, 1, -7, 35, 22}, there are no subsets with sum 0.
>>
>>59280604
Who is this semen extractor
>>
>>59281924
animeposters need to die
>>
>>59281882

First write a program that can find all subsets of a given array and return it as a list<Array> then iterate over that list and call .Sum on each.
>>
File: 2b8.png (346KB, 544x404px) Image search: [Google]
2b8.png
346KB, 544x404px
>>59281927
Anime website
>>
>>59281927
>doesn't know who that girl is
>""""""""""""anime poster""""""""""""
No.
also, >>>/r/abbit
>>
>>59281937
Hm, i'm gonna look into that, lets see if i can find all subsets of an array
>>
>>59280726
>how to order all the statements
Examples? This is ambiguous to me.
>>
>>59281345
It's not, and anyone who thinks so is just deluding themselves.
>>
>>59281345
functional programming is easily multithreadable. since you put a value in and then just get a value out with no side effects, you give your function its value then fuck it off to the side and it can do its thing while you can process other stuff while waiting for it.

in other paradigms it is possible and probable that this function could modify things that will interrupt/break the other things you're working on while waiting for it but with functional programming this cannot happen and the programmer doesn't have to worry about it.
>>
>>59280730
Why is it always a libc? Who even cares about that legacy shit? I'd rather the kernel developers wrote a liblinux so I could easily make system calls. MUCH better, no need to desl with absolute bullshit like errno.
>>
>>59281187
M-x butterfly
>>
>>59281991

Except that mutating data is 90% of what users want to do.
>>
>>59281882
Use dynamic programming.
>>
>>59281937
Next level: solve the problem without calculating the power set beforehand (space complexity of O(n) instead of O(2^n)).

Protip:
>>
>>59282011
yea. it seems like these days a programming language is judged by how well it stops you from doing the bad shit than how much it allows you to do the good shit
>>
>>59280552
Would C be useful for an electrical engineer?
>>
>>59281945
Do you know? pls tell
>>
>>59281991
pure FP ⊂ FP
>>
>>59282038
Yes, in the case you were designing microcontrollers. You are most likely to expose your microcontroller pins through C headers than letting software devs struggle with binary and/or assembly.
>>
>>59282036

express the powerset as a graph and then do a complete walk through it, expressing .Sum on each node.

This really isn't that hard.
>>
>>59282065
> expose your microcontroller pins through C headers
What did he mean by this?
>>
>>59281942
this argument again
>>
looking through old company code
>string sadd = "&apt=" + 6.ToString();
made me laugh
>>
>>59281689
take it and look for another job. be gone at the 6 month mark
>>
>>59282101
Pins are I/O. Each pin corresponds to a register. In the C header, you give each register address a name.

There, you have exposed your pins through a C header.
>>
>>59282078
of course it isn't hard.
it's literally like a chapter 8 question in a learn programming book you tryhard
>>
>>59282232
What if my learn programming book only has 7 chapters?
>>
Can I get some help with my program?
I'm trying to simulate the spinning of a roulette wheel, and I want the numbers that are printed on screen change really fast at first, then slower as they approach the result. I have an array containing all numbers 0-36, ordered cloclwise from 0, just as an actual wheel. I use random to determine the outcome. I'm not sure how to display them correctly. The wheel always makes two spins at least.
>>
>>59282210
>expose
why this word?

C is immensely valuable for an electrical engineer because almost all mcu programming is done in C in 2017
>>
>>59282022
That doesn't help at all
>>
>>59282274
Yes it does. It is literally the "subset sum problem" which is easily looked up. You just have to modify it so it finds all of them.
>>
>>59282232

>Butt devastated that his question wasn't hard
>namedropping chapter 8

legit though 3rd year algorithms is really fun.
>>
File: M07oq.png (9KB, 600x450px) Image search: [Google]
M07oq.png
9KB, 600x450px
>>59282257
Express the wheel as a reversible function with an input from 0...1 and an output from 0...1

Apply an easing function like sin(x)
>>
>>59281187
Being able to write useful programs.

Bonus points if you get paid for it.
>>
>>59282257

is this a graphical application or a console application?
>>
>>59281991
It seems like anyone with a little experience wouldn't be retarded enough to multithread processes that will break each other. Is there anything else?
>>
File: 14837753326550.jpg (36KB, 563x209px) Image search: [Google]
14837753326550.jpg
36KB, 563x209px
Is this a good way of dealing with the consequences of removing IO from a language? I'm thinking of making some sort of system which does all the needed IO at compile time and just bakes the results into the binary. So the program itself doesn't have to do IO.
The first compiler itself obviously would have to do IO, but it can be compiled in a similar way once it's complete.
>>
>>59282321
I don't understand. This is probably the simplest thing that I overcomplicate.
>>59282344
Console.
>>
File: worried laughter.gif (3MB, 540x300px) Image search: [Google]
worried laughter.gif
3MB, 540x300px
>>59282359
jesus christ
>>
>>59282359
That makes no sense.
>>
>>59282359
Thanks for your shitpost.
>>
>>59282359
this is too far
>>
File: 1459082963356.jpg (128KB, 814x438px) Image search: [Google]
1459082963356.jpg
128KB, 814x438px
>>59282370
What happened?
>>59282374
Why is that?
>>
>>59282359
>>59282374
C++ Template Metaprogramming can do that.
They're Turing Complete at compile-time.
>>
>>59282380
What if a user or program must provide additional information to the program?

What if this additional information is a result of information your program has generated?
>>
>>59282358

>multithread processes break each other

Those words don't mean what you think they mean.

Writing a multithreaded process that requires a persistent set of data (i.e. multiple users hitting a database... i.e. every web application ever) is inherently a difficult thing to do with multiple concerns.

I'm not advocating FP as a solution to this. It hasn't been solved properly since the 70's. It's just hard and will almost invariably break in a way you don't expect. And that's before people start TRYING to break it (see : heartbleed)
>>
>>59282396
It doesn't even have to be Turing complete.
C++ is garbage though and I wouldn't be either using it or writing a compiler for it.

>>59282402
Then I guess he could do so and the results of that would be compiled into the binary once again.
>What if this additional information is a result of information your program has generated?
I'm not sure I understand you here. Why would this be a problem?
>>
>>59282396
Lisp macros can do computation at compile-time. http://www.bookshelf.jp/texi/onlisp/onlisp_14.html#SEC95
>>
>>59282362

right, so you need to do this in a loop

int delay_time = 100
while (spinning)
{
print_num(num_ary);
delay(x)
delete_num()
if (spin_time > xyz)
{
delay_time += 20
}
if (delay_time == 1000)
{
spinning = false;
}
}
>>
>>59282359
Report, hide and ignore the troll.
>>
>>59282443
That will have varying speed, depending on the system.
You need to solve it analytically
>>
>>59282425

This sounds like you want to write an interpreter rather than a compiler.

I can't imagine a user WANTING a binary that generates "what is your name" and then after answering, a new binary is compiled, that the user has to run, that prints "Hello <name>!"
>>
File: 1474335032135.png (115KB, 289x277px) Image search: [Google]
1474335032135.png
115KB, 289x277px
>>59282476
Why are you so angry? Do you need a glass of water or something?
>>
>>59282496

depends on the promises your language makes in its delay() function. If delay waits for different times based on your cpu speed then grab that and convert ticks to millis, then apply above solution.
>>
How do I into functional programming?

Coming from Python.
>>
>>59281937
how do i find sums of all subsets in an array?
>>
>>59282544
You can into functional programming with Python.
>>
>>59282544
Learn you a haskell or the haskell wikibook.
>>
>>59282547
var sumOfAllSubsetsOfMuhArray = muhArray.AllSubsets().Select(x => x.Sum());
>>
>>59282573
Python is neither functional nor functional.
>>
>>59282589
Considering you seem to know LINQ, can you explain wtf the fuck is going on in this solution of this >>59281882 problem

It works but i have no idea how it finds subsets of an array

            int[] source = new int[] { 1, 2, -3, 4, 5 };
for (int i = 0; i < Math.Pow(2, source.Length); i++)
{
int[] combination = new int[source.Length];
for (int j = 0; j < source.Length; j++)
{
if ((i & (1 << (source.Length - j - 1))) != 0)
{
combination[j] = source[j];
}
}
if (combination.Sum() == 0)
{
Console.WriteLine("[{0}, {1}, {2}, {3}, {4}]", combination[0], combination[1], combination[2], combination[3], combination[4]);
}
}

Console.ReadLine();


Output

[0, 0, 0, 0, 0]
[1, 2, -3, 0, 0]
>>
>>59282543
>depends on the promises your language makes in its delay() function. If delay waits for different times based on your cpu speed then grab that and convert ticks to millis, then apply above solution.
The code around the delay() won't execute at the same speed on every CPU, not even on the same CPU on an OS with preemptive multitasking
>>
>>59282362
Let x be a range from 0 to 1. You can divide this up into however many steps you want. Say if you wanted 20 iterations, just set x to 1/20 and continuously add 1/20 to it and loop while it is < 1. Let y be the time your program should sleep/delay/etc. In >>59282321, they use y = sin(x), but other functions could work too.
>>
>>59282396
only in the theoretical sense. C++ doesn't expose any way to do IO at compile time. also worth noting that much of template metaprogramming is made unnecessary by constexpr
>>
>>59282685
Compilers let you define macros on the command-line, which is a form of I/O
>>
>>59282443
I don't think that would work like I want it to. I feel stupid for asking, but how would you check for spin time? Alao, what is xyz?
>>
>>59282662

have fun prematurely optimising for your extensive OS/2 and C64 userbases

nerd.
>>
>>59282754
Windows and Linux employ preemptive multitasking.
>>
>>59282767

yes, and the CPU runs at the resolution of nanoseconds. So you might lose a few millis at the OS fucks you over, but if the user doesn't notic then who cares
>>
>>59282680
Okay, so the closer to 1, the slower it gets. How do I make it stop exactly on the random number though? Does the computer automatically calculate where it should start to stop on the random number, or do I calculate the number while it spins, n ammount of times? Basically I'm asking when should I determine the random number.
>>
>>59282706
putting aside that it's a very limited hack, that's technically not *at* compile time, but *before*. one could argue that this solution isn't really "in" C++
>>
File: 1488074887631.jpg (29KB, 597x597px) Image search: [Google]
1488074887631.jpg
29KB, 597x597px
Help, I typed
g++ testfile.h
in the command line and it compiled just fine, then to run it I typed a of course but it wouldn't run. it said
'a' is not recognized as an internal or external command, operable program or batch file.
I can compile and run C source no problem, but with C++ it wants to be mean.
>>
>>59282512
i am building a compiler for a language too qt, just make it simple
write a few assembly functions as an IO library, if that's what you're compiling to
that's what i plan to do

my language will be good enough for anyone to write a real compiler in, that's my goal
>>
>>59282876
kys
>>
>>59282627
Anyone who knows standard implementation of algorithms in something like C or C++ ought to be able to explain this.

I know that the number of possible subsets in a set with 5 distinct elements is 5^2, so that's your first iteration's calc.

After that, I'm not really sure what's happening here:
if ((i & (1 << (source.Length - j - 1))) != 0)

, but if it's satisfied, it tacks another element on the current temp combination. If that adds to 0 when all is said and done, the set is emitted, although that
WriteLIne()
statement is pure faggotry. Should be something like:
Console.WriteLine(string.Join(",", combination));
so it works with more than 5.
>>
>>59282921
>I know that the number of possible subsets in a set with 5 distinct elements is 5^2
No.
>>
>>59282921
>After that, I'm not really sure what's happening here:

That's the part that's puzzling me the most

I know it's performing some bitwise magic but i can't figure out what. It seems that it's moving bits and reseting position at i, or something like that
>>
>>59282938
Are you trolling or am I actually wrong?

Explain if it's the latter.
>>
>>59282921
holy shit dude use recursion
def combs(lst):
if len(lst) == 0:
return [[]]
else:
last = lst.pop()
ans = combs(lst)
ans.extend(map(lambda x: x+[last], ans))
return ans




combs takes a list of letters and returns all the possible combinations
the length of the list is the number of possible subsets
>>
>>59282985
Some non retarded language pls
>>
>>59282938
It's 2^5
>>
>>59282335
So, web app code artistans are real programmers?
>>
>>59282863
Okay nevermind, instead of the end number being random, the start number will be random, makes more sense.
>>
>>59282986
Moron.

>>59282971
>>59283022
>>
>>59282938
>>59283022
>>59283066
Shit, you're right, I'm dyslexic. Annoying that I meant to say 2^5 and didn't even notice I flipped it.
>>
>>59283005
python is ltierally pseudocode

take a piece of paper and do a list of length 3 by hand

it's basically this
subsets(list) = last elf of list appended to subsets(list') where list' is without it's last element

for ex
subsets(abc) is subsets(ab), but you need to extend subsets(ab) by putting a "c" to all members of subsets(ab)
>>
>>59282985
combinations aren't subsets
>>
>>59283167
what
yes they are

order doesn't matter right, it's 2^5
>>
>>59283177
combinations generally refer to subsets of a given size drawn from a set, if I recall correctly.
>>
>>59282078
The powerset as a graph is a hypercube. n-cubes have 2^n nodes. If you build the hypercube before walking it, it defeats the purpose of space optimization.

The idea is to build a hamiltonian path on the hypercube, which amounts to building a Gray code of width n, with each value of the code being a mask for the array of numbers to sum. But stored as such, the Gray code is still O(2^n) in space complexity.
To optimize further, you build the mask iteratively from the Gray code, by flipping the digit of the mask at the position of the least significant bit of the step: for example, starting from mask 0, at step 6 (110), you would flip the second digit of the mask. Calculating the mask this way is both O(n) in space and time complexity.

Then at each step, you apply the mask to the array and calculate the sum for the unmasked elements. At the end, you actually walked the hypercube without even storing it.

brb, implementing
>>
>>59283038
Sure, if what they write is useful.

Being a good programmer is about adding value to the world by manipulating machines in such a way that human effort is reduced.
>>
>>59283205
>at the position of the least significant bit of the step
at the position of the least significant SET bit of the step, this is important (fuck why can't i reread myself before posting)
>>
>>59283205
>tfw you have no idea what the guy is talking about
>>
>>59283205
fucking bullshit faggot
hamiltonian path is np complete, why should i google what a gray code is then
>>
>>59283273
go poop on yourself you worthless codemonkey
>>
>>59283294
Jokes's on you, i don't even have a job
>>
>>59283205
>graph
>not hypergraph

It's like you enjoy not being abstract.
>>
>>59283289
Deciding if an arbitrary graph has an hamiltonian path is NP-complete, but there is no such problem in the special case of hypercubes, you can easily prove they always have one by construction. This is the property I exploit to optimize space complexity of the subset sum problem, but of course, it is still NP-complete itself.
>>
File: anal beads.png (14KB, 355x623px) Image search: [Google]
anal beads.png
14KB, 355x623px
>>59281882
>>59282627

>DUDE POWERSETS LMAO
Haha Just Plagiarize How Can This Be An Issue If The Wheel Is Invented?!

public static T[][] PowerSet<T>(this T[] seq)
{
var powerSet = new T[1 << seq.Length][];
powerSet[0] = new T[0];
for (int i = 0; i < seq.Length; i++)
{
var cur = seq[i];
int count = 1 << i;
for (int j = 0; j < count; j++)
{
var source = powerSet[j];
var destination = powerSet[count + j] = new T[source.Length + 1];
for (int q = 0; q < source.Length; q++)
destination[q] = source[q];
destination[source.Length] = cur;
}
}
return powerSet;
}


static void Main(string[] args)
{
void WriteSetsOfSet<T>(T[][] muhPowerSet) => muhPowerSet.ForEach(x => WriteLine(string.Join(" ,", x)));

WriteLine("This is the powerset:");
var ayy = new[] { 1, 2, -3, 4, 5 }.FastPowerSet();
WriteSetsOfSet(ayy);

WriteLine("These are the subsets that sum to 0:");
var lmao = ayy.Where(x => x.Sum() == 0).ToArray();
WriteSetsOfSet(lmao);

WriteLine("Press any key to exit...");
ReadKey();
}
>>
>>59283348
The fuck's an hypergraph?
>>
>>59283559
The edgiest of graphs.

Instead of having one-to-one edges, you can have n-to-n edges in such graphs (n less or equal to the number of nodes of course).
>>
>>59283578
>>59283578
>In mathematics, a hypergraph is a generalization of a graph in which an edge can join any number of vertices.

kk
>>
Is there a way to check for duplicates entries in the columns of a 2d array/list in Python?
>>
>>59282876
idiot
>>
>>59283724
a = [
[1, 2, 3, 4, 5],
[7, 8, 9, 4, 1],
[3, 2, 5, 8, 1],
]

def transpose(*data):
return list(map(list, zip(*data)))

def find_dupes(data):
return set(str(v) for v in data if data.count(v) > 1)

for index, col in enumerate(transpose(*[row for row in a])):
print('Col {} duplicates: {}'.format(index, ', '.join(find_dupes(col))))


» python dupes.py
Col 0 duplicates:
Col 1 duplicates: 2
Col 2 duplicates:
Col 3 duplicates: 4
Col 4 duplicates: 1
>>
>>59283578
>>59283617
Is there a graph where edges can point to edges as well as nodes?

Why is the set of edges disjoint from the set of nodes anyway?

I bet that'd be the ultimate data structure.
>>
>>59283724
rotate + 2/3s of a monad + distinct
>>
>>59283902
>set(str(v) for v in data if data.count(v) > 1)
very cheap
>>
>>59283996
that's not even THAT cheap, I could have gone with Collections.counter instead :^)
>>
Visual Studio 2017 downloads are available:

https://my.visualstudio.com/Downloads?PId=2192
>>
>>59284351
nobody likes VS
>>
File: 1488864437629.jpg (28KB, 525x431px) Image search: [Google]
1488864437629.jpg
28KB, 525x431px
>>59284351
>>
>>59284351
>tfw no community update for poorfags
>>
>>59284444
Click "developer tools" on the left.

It's there.
>>
File: anal beads.png (2KB, 133x63px) Image search: [Google]
anal beads.png
2KB, 133x63px
>>59284351
:(
>>
>>59284351
Does 2017 fully support C++14 yet or is it like 2015 that misses half of the features even though it's been a few years already?
>>
File: tfw.png (11KB, 887x316px) Image search: [Google]
tfw.png
11KB, 887x316px
>>59284458
>>
File: mens asses.png (245KB, 1084x1880px) Image search: [Google]
mens asses.png
245KB, 1084x1880px
>>59284473
hmm
>>
>>59284481
>that font rendering
my fucking god
>>
Behold a lock!

trait LockUser
fun useLock(data : U64): U64

actor Lock
var _data : U64 = 0

be lock(user : LockUser)
_data = user.useLock(_data)
>>
>>59284498
I'm at work, 1280x1024 is my max res and I'm pretty sure that's the perfect res for Wangblows 10 to display its best fuckups. I have the botnet at home and my fonts aren't anywhere near as bad.
>>
whats a good resource for learning perl?
>>
>>59282321
>>59282680
>>59283042

not him but since I'm bored to death I did the first think that came to my mind

Do you think that could be a good idea ?


int i=0;
int strength = random(200 , 600);

do {
print(wheel_values[i]);

delay(1000 - strength);

i++;
if(i>nb_value)
i=0;

strength -= 5;
}while(strength>0);
>>
>>59284590
Go into Control Panel and find cleartype settings or whatever it's called on Windows, you should be able to make it look at least slightly better even on that res. It could also be in Display Settings instead, I forgot, been a long time.
>>
>>59284602
Learning Perl
>>
>>59284742
yes, what's a good resource for doing that?
>>
>>59284715
What if I don't want ClearType but pixel-perfect fonts?
>>
>>59284757
"Learning Perl"
>>
>wrote this function yesterday to test if I can access CR0.
>posted it here, you may have seen it.
>tried to use it:
if (!test_cr0_access()) return;
asm volatile("mov %0, cr0;":"+r"(*this));

>shit kept crashing for no apparent reason
>check disassembly:
12e92:   0f 20 c6        mov    esi,cr0
12e95: e8 c6 fd ff ff call 12c60 <test_cr0_access()>
12e9a: 84 c0 test al,al

Goddamnit, gcc.
>>
>>59284715
Done, life is already better.
>>
>>59282896
How do you write a programming language?

I want to make my own lang too
Write all my programs in it
>>
If i want to do this in c#
myclass blah = (myclass) (new myclass2());
Do i need to put the explicit operator in the myclass or myclass2?
>>
>>59282921
Read Hacker's Delight. Explains bitwise operations and even talks about their applicability in subset operations.
>>
>>59285093
Study DFAs, NFAs, pushdown automata, CFGs, etc. Basically what you'd see in a theory of computation course. Then write an interpreter for a simple language, like brainfuck. Then do the same thing for a more complex language. etc etc
>>
>>59285093

Programming Languages and Pragmatics by Scott is a great book for learning more about how to go about this, it goes in depth on the topics people responding your reply are telling you to study
>>
>>59280552
Programming a babby-tier arduino that will implement a GPS tracker/no fly zone on a small drone for a team-project class
>we don't have our arduino yet
>we don't have any of our hardware delivered yet
>can't be sure if any of the shit I'm throwing together will even work since the project leaders for this class are so incompetent
>at least my code looks nice
>>
>>59285288
Put uLisp on it.
>>
>>59285344
We don't even have the board yet, I'm just writing some preliminary code that interfaces with our Google firebase server and has some baby-tier pathfinding to avoid entering no-fly zones.

We put in like an hour or two a week into this, tops. The class is kind of a joke.

I might throw ulisp on there when I'm testing the interfacing with the flight controller, though.
>>
File: 1430627333_extremetuxracer.jpg (66KB, 800x600px) Image search: [Google]
1430627333_extremetuxracer.jpg
66KB, 800x600px
>that moment when you realize programming is just moving text and numbers around and comparing them
>>
>>59281187
Wearing long socks.
>>
>>59285471
>understanding neither low-level nor high-level
>>
File: asm.png (14KB, 757x386px) Image search: [Google]
asm.png
14KB, 757x386px
Trying to learn 6502 Assembly and NES programming. I've never written a useful program (in any language) in my life. But, you can never know too much.
>>
File: vitality.png (159KB, 307x311px) Image search: [Google]
vitality.png
159KB, 307x311px
>>59285471
>being this retarded
>>
>>59285501

i know that everything is represented in bits and bytes, outside of that tho its just setting up your data structures and solving problems with that data. Prove me wrong
>>
>>59285546
Mechanical computers
>>
File: pro9.gif (1020KB, 500x373px) Image search: [Google]
pro9.gif
1020KB, 500x373px
>>59285541
I tried that. Quit while you're ahead.
>>
File: outlet.jpg (22KB, 650x402px) Image search: [Google]
outlet.jpg
22KB, 650x402px
>>59285610
What's the matter? Kode babby can't understand hex?
>>
>>59285134
Goes in MyClass2.

class Program
{
static void Main(string[] args)
{
var muhOther = new MuhOtherClass();
MuhFirstClass muhFirst = (MuhFirstClass)muhOther;


}
}

class MuhFirstClass
{
public string MuhProperty { get; set; }
}

class MuhOtherClass
{
public string MuhProperty { get; set; }

public static explicit operator MuhFirstClass(MuhOtherClass muh)
{
return new MuhFirstClass { MuhProperty = muh.MuhProperty };
}
}
>>
>>59280552
I'm interested in emulation, but I've never written an emulator. I've seen CHIP-8 pop up here every so often, so I assume it's a decent starting project. Agree or disagree? What resources would you recommend for a beginner?
>>
>>59284831
>what is asm volatile("": : :"memory")
>>
>>59285665

c# hurts my eyes
>>
>>59285819
Xamarin nearly drove me to suicide once. True story.
>>
I want to make a program that will have both a linux and a windows version. I'm gonna do it using qtcreator, since there there are versions of the IDE for both OSs. But, I've never made a program that can run on both. If I wrote the linux version first, what kind of changes would I have to make to the source code so that I can simply copy all the source to the windows project and compile it right away? Also, if I wanted to use git for version how would I control both releases at once?
>>
>>59285667
CHIP-8 is more of a virtual machine than anything. You don't have to manage CPU cycles for example. Still, it's interesting to implement if you wanna get your hand in the management and the coordination of audio, video and input at the same time.
>>
>>59281241
be a quant. but you need a phd for that
>>
>>59285996
>what kind of changes would I have to make to the source code so that I can simply copy all the source to the windows project and compile it right away
Usually if there are changes to do you make them by using #define and changing the parts depending on the defined OS macro. But until you tell us what libraries you plan to use we can't tell you more.
>>
>>59286042
Its going to be a simple program, I'm going to try and avoid opengl if I can, and just use what qt has to offer. Since I can't remember the last time that I actually programmed anything in c++ on windows I think the biggest difference is going to be whatever I have to include in the win version for IO as opposed to <iostream> on linux, or even that remains the same.
>>
>>59283005
Anyone here programs D? How is the language right now..?
For example, has the GC improved any bit and is the hability of using the standard library without it in the works?
>>
>>59286118
iostream is a standard library header, I'm quite sure you can use it on both platforms.
>>
>>59280552
not sure if here is the place, but I have a question: I got two job interviews and I'm sure I will be offered the job. What should I say if I'm asked if I have another offers on any of the two interview? how can I have an "edge" in my situation?
>>
>>59286153
Use Lisp.
>>
>>59286197
Mention it when you are negotiating money.
>>
File: 1433004809582.jpg (98KB, 378x485px) Image search: [Google]
1433004809582.jpg
98KB, 378x485px
>download two (2) compilers
>run separate codes on them
>???
>parallel computing
>>
>>59286212
Nice shitpost.
>>
File: afreeyou.jpg (51KB, 448x468px) Image search: [Google]
afreeyou.jpg
51KB, 448x468px
>>59286218
Thanks I worked very little for it.
>>
>>59286118
Also if you plan to write shared libraries you'll have to do the retarded dllexport thing on Windows I believe. Usually people write some NAMEOFPROJECT_API macro which they leave empty if it's Linux/other and set to the dllexport thing when it's built on windows.
>>
>>59281250
it's one of the worst of the current generation of frontend tech.
>>
>>59286249
>dllexport
but that's what header files are for...
>>
>>59286194
Well, if anything I didn't expect happens I'll ask away.
>>
>>59281679
Is it even possible to be picky in this job market?
You either starve or you work a shitty job because the stars aligned and the HR didn't trash your resume this time.
>>
>>59285671
tried that, didn't do anything.
I had to use
bool cr0_access = test_cr0_access();
if (!cr0_access) return;
asm volatile("mov %0, cr0;":"=r"(*this):"rm"(cr0_access));
>>
Hi! iv'e been meaning to get into computer science and programming by myself, but i don't know where to start. Any good place to start coding? Which language should i start on?
>>
>>59286389
>coding
I recommend reddit.com
>>
>>59286389
First, try not to say coding, you are programing. And you are making programs, not apps.

Second, most people would recommend you C, since it's fairly low level so you can get a little bit more insight into a computer's inner working. Also, java and c++, two other fairly popular languages, are similar enough that when you get a good knowledge of C transferring will be easier and learning the object oriented paradigm will be easier since you will have already mastered more basic concepts from C.
>>
>>59286490
First, try not to say programing, but rather, programming.
>>
>>59286311
bullshit
https://godbolt.org/g/0v4st4
>>
>>59286490
>object oriented paradigm
Nice try. This guy is trying to troll you.
>>
>>59286389
Learn Common Lisp. Install Roswell (https://github.com/roswell/roswell) and run
ros install sbcl

Enjoy your Lisp.
>>
>>59286389
Optionally start with Bash, then C then Haskell or Lisp or OCaml.
>>
File: Interviewer.jpg (17KB, 350x244px) Image search: [Google]
Interviewer.jpg
17KB, 350x244px
What's the difference between a statement and an expression?

You have 10 seconds.
>>
>>59286661
expressions return values.
>>
>>59286661
I can't possibly type the whole C grammar and semantics in 10 seconds. But statements don't return value as opposed to expressions.
>>
I'm editing my CV for a crappy programming apprenticeship

How would I write
>Excellent at programming logic
In a smart sounding way?

I am genuinely good at logic, but I don't know how to express this in a sentence.
>>
>>59286637
>Haskell
Dropped.
>OCaml
Dropped.
>>
>>59286704
this is like applying to a construction job and writing "i can swing hammers good"
>>
>>59286704
>Excellent at writing if-statements
You can't.
>>
>>59286661
Depends on the context of your question. Here, I've copied and pasted some sentences from the internet:

>An expression is a sequence of one or more operands and zero or more operators that can be evaluated to a single value, object, method, or namespace.

>A statement is a line of code that does something.
>>
>>59286637
This, but ignore lisp garbage.
>>
>>59286710
>Implying I can swing hammers good is a good comparison
>>
>>59286734
This, but ignore "ignore lisp garbage" garbage.
>>
>>59286710
I'm applying for a computing apprenticeship aimed at 16-18yo
The only qualifications are at least a C in GCSE maths and English and no previous programming experience

I'm 21, but I don't see why they wouldn't take me. I've written games in a number of languages.

I'm applying because there was a qt girl in the picture advertising it, and there are no jobs that don't require a shit tonne of experience where I live.
>>
>>59286704
>I have a proven track-record of algorithmic excellence in low- and high-level languages.
>Also, I do not have a gag reflex. Winky face.
>>
File: Screenshot_2017-03-07_20-04-04.png (719KB, 1366x768px) Image search: [Google]
Screenshot_2017-03-07_20-04-04.png
719KB, 1366x768px
Added image/video viewing mode. Now working on drag&drop.
>>
>>59286761
>I'm applying because there was a qt girl in the picture advertising it
That's a good enough reason as far as I'm concerned.
>>
>>59286761
>he fell for an ad
>>
>>59286710
Also, I've been doing landscaping work for the past few months for some cash.
But I broke both my collar bones, and I can no longer work because I can no longer swing a hammer.
>>
>>59286741
It sounds weird because it's a given.
>I can breathe good and I shower every day
is also not a good resume item, because you're expected to do these regardless.
>>
>>59286761
>looking for 16-18 year old with no programming experience
>be a 21 year old with programming experience
>surely they'll hire me!
>>
>>59286750
Why would someone ignore the truth? Unless their brain has been severely damaged by scripting-tier shitlangs like lisp of course.
>>
>>59286802
I have no programming qualifications, so I cannot get a real programming job.

I don't see why they wouldn't accept me. At least I will be good at the course.
>>
>>59286761
At 21, you should already have 5 years of industry experience.
You are literally unemployable, you have a giant 5 year gap period with no industry relevant experience and no way to explain it.
Also, you signed up because a stock photo of a girl was on the ad.
>>
>>59286795
>I shower every day
>you're expected to do these regardless
wait? seriously?
>>
Objectively fun obscure languages:

Smalltalk
Prolog

what else
>>
>>59286807
>he actually believes this
Anon, I'm sorry to tell you this, but you have no brain!
>>
>>59286828
yes you fucking neet
everyone can smell your awful BO but nobody will ever tell you up front because it's rude

you're not holding up your end of the social contract
>>
>>59286843
Lisp. Complete the trifecta.
>>
>>59286844
I don't want to be friends with you anymore.
>>
>>59286851
some women told me they like my BO tho

wat it do?
>>
>>59286851
damn, do I really have to do it every single day? or would a few times per week be fine too?
>>
>>59286886
It's okay anon. What programming languages do you identify with the most?
>>
File: futurewife.png (264KB, 328x352px) Image search: [Google]
futurewife.png
264KB, 328x352px
>>59286826
>You are literally unemployable
I know. I get bored easily.
>Gap year after college to retake exams
>Dropped out of physics degree after 1 year
>Dropped out of Engineering Apprenticeship after 7 months
>Been NEET for 14 months

>Also, you signed up because a stock photo of a girl was on the ad
She's qt, and I have had virtually zero female contact in the past 6 years.
>>
>>59286900
Don't shampoo every day, but yes, you give yourself a once over with soap every single day.

I can't believe you've been around this long without knowing this.
>>
>>59286900
Once every thousand years.
>>
>>59286912
Not that qt desu
>>
showering everyday is a numale capitalism indoctrinated thingy desu. social ""contracts"" my ass
>>
>>59286901
My own language.
>>
>>59286915
this isn't true I shower maybe once a week and only use deodorant or cologne when going out with friends
>>
>>59286963
gross
>>
>>59286929
She qt enough that I am sending a CV over to the company

We can play noughts and crosses in a game we make together in Javascript as part of the course
>>
>>59286976
They want to hire kids and pay them summer job wages, they don't want to hire you.
Even if they did, you'd be let go in the fall.
>>
>>59286912
in your position the smartest thing to do would be to build simple projects like a simple CRUD database project in a language to show off to employers and take programming courses at your local community college
>>
>>59286996
They want to train people to work in their company. They pay enough to cover all my expenses, and leaves me with £5,000 left over at the end of the year.

They want people to be apprentices because they get government grants to do it. They would receive a government grant for me aswell, and I wouldn't be dead wood in their organisation for as long as the other students.
>>
>>59287055
>They would receive a government grant for me aswell
Isn't there some age condition on these grants?
>>
>>59287032
I have a few projects that would look good if I ever finished them.

I really should finish something to show an employer, before I get too invested in my current project.

>>59287065
They will have to pay maybe £1,000 for the person to attend a local college if they're older than 18.
>>
>>59287092
First thing you need to do is finish those basic projects then the rest is easy to do
>>
>>59281594
>learn Haskell

As in, you copy-pasted the shitty quicksort from Learn you a haskell and now call yourself a haskell programmer gj
>>
>>59287120
Haskell is garbage anyway. Let him enjoy his moment.
>>
Remind me that cool book about Haskell I started to read a few years ago
>>
>>59285541
Search for and read the post where a guy makes a 6502 assembler in Common Lisp.
>>
>>59287170
Learn You a Haskell
Programming in Haskell (2nd edition)
The Wikibook
Write Yourself A Scheme
>>
>>59287170
The Very Hungry Caterpillar
>>
>>59281594
>get PhD in math
>any job I want
>$300k starting
>>
> 260 posts
> no mentions of Rust
Rust.
>>
File: 1459043445218.jpg (28KB, 450x338px) Image search: [Google]
1459043445218.jpg
28KB, 450x338px
>>59287305
>>
is vb.net useful or is it shiiet
>>
>>59287334
The language recommended by traps:

use std::mem::transmute as crossdress;

struct Boy;
struct Girl;

fn main() {
let Hime: Girl = unsafe { crossdress(Boy) };
}
>>
>>59287342
useful shiiet
>>
>>59287342
It's more useful than Haskell and Rust.
>>
How expensive is LEA? Is it the cost of a single ADD, the same cost as 2 ADDs and a SAL, or something in between?
>>
>>59287407
http://www.agner.org/optimize/instruction_tables.pdf
>>
>>59287407
ADD costs more. LEA has basically no cost.
>>
I need some java help friends. I have a simple spring boot web application that's linked to a database. At the beginning of each month (00:00:00) I want to reset a field in that database

How would I go about creating such a method?
>>
>>59287474
What kind of database?
>>
>>59287474
you would use the java Date class to get the month and set the text field to empty or reset it to whatever number etc
>>
>>59287524
mysql, but it's not so much the database deletion part i'm worried about, more how do I make something that just runs once a month
>>
>>59287342
useful for a job maintaining legacy code, however you ought to learn C# instead
>>
>>59287551
You can use the mysql event scheduler. https://dev.mysql.com/doc/refman/5.7/en/event-scheduler.html
>>
>>59285471
This is true.
>>
>>59287380
>
>>
>>59287342
VB.NET is the same as C# but BASIC
>>
>>59287696
BASIC bitch language
>>
>>59281942
Fuck off to /b/ with your chink cartoons, Were trying to discuss technology here.
>>
>>59287719
Anime is a technological marvel.
There are some really interesting pieces of software, like the ones that convert faces to an anime style, ones that animate anime characters to real life motion, voice emulators, etc


desu
>>
>>59282037
Haskell will still give you enough roupe to hang yourself with. If you want to cram everyting into monads then go ahead. Each language is less a set of tools and more a way of thinking about code. Tools (things that allow you to do cool stuff) come from libraries.
>>
>>59287739
>Haskell will still give you enough roupe to hang yourself with.
It's shit.
>>
>>59283005
let me guess, you program in c? you dumb motherfucker
>>
>>59285819
It's so wordy just give me the fucking algos, i don't need one hundred words to say this simple thing jesus
>>
>>59287696
With event handler (with events) and mutli indexed properties
VB > C#
>>
>>59282037
>>59287739
At his point I just ignore any 4chan post that gives opinions on a language.
>>
>>59287854
German is cool desu
>>
>>59287342
It should not be your first language at all, but once you have one or two under your belt, it'll come fast and easy and then you're employable forever.
>>
>>59287854
Any kind of opinion? I feel like it's probably smarter to just ignore the ones that make blanket statements like >>59287756, but >>59287853 has actual reasons for the ranking.

I don't agree at all, vb.net sucks, but at least they included a reason.
>>
>>59287772
C is perfectly acceptable for a 20th century programming language
>>
>>59287897
It's a shame that the reason is made obsolete by the myriad of more idiomatic options for what they mentioned, and they've conveniently left out the many things that C# has over VB.
>>
>>59287942
>many things that C# has over VB.
Like what? Everything was ported to VB. Even the anonymous action.
>>
>>59287407
If all you're doing is add, an add instruction is better because they can typically go to more execution ports and at be issued more often.
But a lea of course does more work, it can mov, add, scale and immediate add all in one.
They also affect flags differently (lea doesn't update them at all) which one you want depends on the rest if the code.

Asking a simple question about instruction vs instruction on modern cpus is futile, the answer is always: it depends.
>>
>>59287873
unless your next language is haskell
>>
Trying to add a feature to VSCode but holy shit there's so many files it's hard to find what you're looking for, it's been an hour and I'm only halfway done even though it's a minor feature.
>>
>>59288084
what feature?
>>
File: 1423163924333.jpg (137KB, 1024x984px) Image search: [Google]
1423163924333.jpg
137KB, 1024x984px
>>59286843
Fortran
>>
>>59286843
Haskell
>>
>>59286843
Forth
>>
really vortexed my cortex tbqh

https://vimeo.com/71278954
>>
I'm giving up on combining linear and dependent types. My thoughts were to encode and generalize the ideas of linear types as algebraic effects, which apparently is not a novel concept. Bingo.
>>
>>59288199
Judging from the slides it doesn't look like he says anything of value at all
>>
>>59288124
Trash.
>>59288158
Trash.
>>59288164
Not trash.
>>
New thread:

>>59288217
>>59288217
>>59288217
>>
>>59287873
Ive done some basic c++ and some object oriented java
Im thinking of choosing this or c# for this semester
I know c# is better but the professor teaching it is kinda bad
Thread posts: 313
Thread images: 30


[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.