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

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

Thread replies: 255
Thread images: 36
File: K&R himegoto waifux2.png (1 MB, 1000x1400) Image search: [Google]
K&R himegoto waifux2.png
1 MB, 1000x1400
old thread: >>54089247

You have been visited by the crossdressing C programmer of Shimoshina Academy!

Good performance, triple indirection, and tail call optimization will come to you, but only if you post "Keep overflowing the stack, Hime!" in this thread.
>>
What is objectively the best genre of music to listen to whilst programming
>>
>>54096898
Why care about tail call optimizations, when I could just write it as a loop?
>>
File: non-binary logic.png (91 KB, 880x1360) Image search: [Google]
non-binary logic.png
91 KB, 880x1360
Keep overflowing the stack, Hime!
>>
>triple indirection
>implying that's a good thing
Kill yourself
>>
>>54096914
J-pop and metal fusion
>>
>>54096898
LITERALLY KILL YOURSELF CANCER FAG

REAL THREAD: >>>>54096919
>>
>>54096914
this https://www.youtube.com/watch?v=aHk42kDwesM
>>
Friendly reminder that there is nothing wrong with a linked list stack!

struct _llist_node {
unsigned data;
struct _llist_node *next;
};

struct _llist_head {
struct _llist_node *head;
unsigned size;
};

typedef _llist_node lnode_t;
typedef _llist_head llist_t;

llist_t stack;
llist_init(&stack);
llist_push(&stack, data);
unsigned val = llist_pop(&stack);
llist_destroy(&stack);
>>
>>54096949
This literally made my ears bleed.
>>
>>54096949
Is there a hidden message in this that turns me into a weeb
>>
>>54096919
>>
>>54096969
Yeah, at 7:32
>>
>>54097010
>>54096973
>>54096985
Stop forcing your thread, shitposter.
>>
>>54097010
This thread came first. Kill yourself.
>>
>>54096962
>http://www.cnn.com/2016/03/10/politics/donald-trump-protestor-punch-face/
>http://thehill.com/blogs/ballot-box/273673-trump-protester-assaulted-at-rally
>http://www.nytimes.com/2016/03/17/us/politics/deputies-punished-after-assault-on-protester-at-donald-trump-rally.html
>https://theintercept.com/2016/03/21/video-shows-donald-trump-incites-violence/
>>
>>54097023
>WHAT IS THE BUMP LIMIT
>WHAT ARE STUPID FUCKING TRAPPOSTERS

FUCK YOU FAGGOT
>>
>>54097018
>>54097023
DIE IRL
>>
>>54097036
No one cares, you fucking autist.
>>
File: akari eats chippus.png (131 KB, 256x256) Image search: [Google]
akari eats chippus.png
131 KB, 256x256
>>54097056
>>54097041
>>54097036
>>54097010
>>54096973
>this is what an autistic freakout looks like
>>
Who the fuck cares what the gay OP image is?

Lord have mercy.
>>
File: 1392544004521.jpg (423 KB, 1097x2193) Image search: [Google]
1392544004521.jpg
423 KB, 1097x2193
>>54096898


>>54096867

anyone know what the fuck is the best option?
>>
File: quality.jpg (103 KB, 800x600) Image search: [Google]
quality.jpg
103 KB, 800x600
>>
>>54097101
OP images and text have a noticeable affect on the quality of the thread.
>>
>>54097202
>affect
effect*
>>
>>54097101
When OP posts a trapshit photo half of the thread is devoted to shitposting guaranteed. See evidence above.
>>
>>54097189
function swap sounds confusing. i'd just go two different connection objects. i mean why even bother trying to have just 1?
>>
>>54097246

Only due to the anti trapshit shitposting.
>>
>>54097246
No one fucking cares, autist. Just because you tried to derail the thread with your shitposting doesn't mean that the thread actually derailed.

Also, you posted anime in your thread so shut the fuck up weeaboo.
>>
Someone say weeaboo?

https://www.youtube.com/watch?v=Mh5LY4Mz15o
>>
>>54097246
>photo
I'm beginning to think you may have lost touch with reality.
It's a drawing. Nobody fucking cares what the OP pic is.

Stop trying to derail threads just because you didn't get to force your not-moe anime waifu
>>
Need a cross-platform GUI, some sort of random Cpanel running scripts (python, but supose I can change it)
Just found Electron.. so:
Is electron a meme? Or is it worth considering?

(PyQt license kills me)
>>
>>54097258
>>54097259
>>54097273
>>54097274
See? told you
>>
Has anyone tried stockfighter yet?
>>
Look at my trip to see what I'm working on
>>
>>54096914
Jack black octagons loop but backwards
>>
>>54097273
that was informative
>>
>>54097273
>>54097374
It actually was. It was cancerous, but still very informative.
>>
>>54097282

>is electron a meme?
Let's put it this way -- do you want to embed an entire web browser in your GUI application? Pretty much anything is better than Electron.

>PyQt license kills me
If you want ot use Python, PyGTK is LGPL. Will that work for you?
>>
Hey /dpt/, what`s the best way to tokenize a lisp string? My strReplace function isn`t putting spaces around the brackets so it isn`t splitting the string into tokens properly...

vector <string> tokenVector;

void strReplace(std::string& str, const std::string& from, const std::string& to){
if (from.empty()) return;
string::size_type start_pos = 0;
while ((start_pos, str.find(from, start_pos)) != std::string::npos){
str.replace(start_pos, from.length(), to);
start_pos += to.length();
}
}

int tokenize(string chars){
try{
// convert string of chars into list of tokens:
strReplace(chars, "(", " ( ");
strReplace(chars, ")", " ) ");
char_separator<char> sep(" ");
tokenizer< char_separator<char> > tokens(chars, sep);
BOOST_FOREACH (const string& t, tokens){
cout << t << endl;
}
/*
string buf; // buffer string
stringstream ss(chars);
while (ss >> buf){
tokens.push_back(buf);
cout << buf;
}
*/
return 0;
}catch (...){
return 1;
}
}
>>
>>54097405
Gonna be honest, I'm completely lost, I've been reading for days, perhaps I'm going to fast...
>Have no idea of license terms, just heard PyQt is somewhat restrictive if I want to sell it
>Currently I'm learning this: https://python-gtk-3-tutorial.readthedocs.org/en/latest/index.html is this the same as PyGTK?
>Just found electron, and wanted to check it prior to keep GTK

Thanks
>>
File: mustard.jpg (144 KB, 500x500) Image search: [Google]
mustard.jpg
144 KB, 500x500
Would you rather use a vector or a hashmap to store arbitrary amounts of input data?
>>
>>54097575

It depends.
>>
>>54097575
flattened vector<vector<..>>
>>
>>54097474

>Have no idea of license terms, just heard PyQt is somewhat restrictive if I want to sell it
Normally, Qt is licensed under the LGPL, but has commercial licenses available for pay. PyQt is a port of Qt to Python, and is licensed under the GPL, but has commercial licenses available for pay. So basically, unless you pay up, you have to GPL your application.

>Currently I'm learning this: https://python-gtk-3-tutorial.readthedocs.org/en/latest/index.html is this the same as PyGTK?
No, actually, and by the looks of things, you've got the better library there. PyGTK uses GTK2, while PyGObject (which is what your tutorial is using) is using GTK3. Both are LGPL and will serve your needs fine.

>Just found electron, and wanted to check it prior to keep GTK
Using electron is like using a butcher knife to hammer a nail. Wrong tool for the job.
>>
>>54096809
teach me your ways, oh functional D anon
>>
>>54097649
What's so complicated about it?
>>
>>54097657
the fuck does that iota shit do?
>>
>>54097672
iota(n) generates the range [1..n]
>>
>>54097681
whoops, it's [0..n-1]

you can specify the start too if you want
>>
>>54097672
In this case I basically just use it to do the equivalent of a for loop
>>
>>54097681
so it's just
string output = "";

foreach (x; 0..3)
{
foreach (i; 0..uniform(4, 8))
output ~= vocab[uniform(0, $)] ~ ' ';
output ~= '\n'
}

?

I actually don't know whether you can do 0..foo() or if it has to be a compile time constant, but in principle this is the same, right? Just less expression oriented
>>
>>54097644
God bless you.
>>
>>54097745
basically

also I'd be surprised if you couldn't do ..uniform, but it might be one of the things compile time D can't do because of bullshit (like manipulate maps, or use regex)
>>
>>54097745
I think there's a function somewhere that lets you pick a certain number of elements from a range (which is what I should have done) but I can't figure it out
>>
>>54097790
If it defines the slice operator, that would be the easiest
foo[1..5];


alternatively, std.range has drop(range, size_t) to remove n elements from a range, and take(range, size_t) to take n elements from a range
>>
>>54097397
this
>>
>>54097862
No, I mean randomly
>>
>>54096898
Stop this programming fag meme
>>
Using Jackson to parse JSON files into a ArrayList.
Now I have to prepare the POJOs into a GraphML file.
Any suggestions?
>>
In Visual Studio:
Dark or blue theme?
This is VERY important
>>
>>54097936
Dark, every time.
>>
>>54097941
You think so? It's definitely easier on the eyes, but there's just some cuteness that comes with blue. I'm so torn
>>
>>54097950
Blue's too bright but there's definitely something to it
>>
>>54097950
>bljew
>>
>>54097924
Stop this Stop this programming fag meme meme
>>
>>54097967
Stop this Stop this Stop this programming fag meme meme meme
>>
>>54097924
>>54097967
>>54097977

>meme
>>
>>54097977
programming fag ((Stop this)(meme))^n
>>
>>54097957
>>54097963
I'll stick to dark
>>
>>54097936

Blue theme. I never did get into that whole light-text on dark-background thing.
>>
File: OSGTP.jpg (126 KB, 1300x936) Image search: [Google]
OSGTP.jpg
126 KB, 1300x936
>>54097998
That's because you prefer black
>>
>>54098019

You caught me.
>>
File: andrei.jpg (42 KB, 512x512) Image search: [Google]
andrei.jpg
42 KB, 512x512
import std.range, std.stdio, std.algorithm;

int main()
{
recurrence!((a, n) => a[n-1] + a[n-2])(1, 1).take(20).each!writeln;

return 0;
}
>>
>>54098101
dumbass
import std.functional
recurrence!(memoize!((a, n) => a[n-1] + a[n-2]))
>>
>>54098132
>memoize!

Holy shit. D greatest of all time.
>>
>>54098132
recurrence is part of std.range, and it's iterative (it returns an infinite forward range, not random access), so memoisation is pointless

that one uses literally 2 integers of state

dumbass
>>
>>54098132
>memeoize!!1
>>
>>54098178

Memoization is tight. Not maymay at all.
>>
>>54098177
Dbag BTFO
>>
>>54098178
! is template parameter syntax
a!b // call template a with b
a!(...) // call template a with (...)
a!b(...) // call a!b with (...)
a!(...)(...) // call a!(...) with (...)
>>
>>54098177
proofs (stripped a bit)
struct Recurrence(alias fun, StateType, size_t stateSize)
{
private import std.functional : binaryFun;

StateType[stateSize] _state;
size_t _n;

this(StateType[stateSize] initial) { _state = initial; }

void popFront()
{
static auto trustedCycle(ref typeof(_state) s) @trusted
{
return cycle(s);
}

_state[_n % stateSize] = cast(StateType) binaryFun!(fun, "a", "n")(
trustedCycle(_state), _n + stateSize);
++_n;
}

@property StateType front()
{
return _state[_n % stateSize];
}

enum bool empty = false;
}

Recurrence!(fun, CommonType!(State), State.length)
recurrence(alias fun, State...)(State initial)
{
CommonType!(State)[State.length] state;
foreach (i, Unused; State)
{
state[i] = initial[i];
}
return typeof(return)(state);
}

https://github.com/dlang/phobos/blob/master/std/range/package.d
>>
>>54098177
>>54098192
>recurrence is a forward only range
faith in D lost
>>
File: smug alexandrescu.jpg (94 KB, 960x540) Image search: [Google]
smug alexandrescu.jpg
94 KB, 960x540
>>54098196
>implying based andrei doesn't have your back

struct Sequence(alias fun, State); 

auto sequence(alias fun, State...)(State args);
Sequence is similar to Recurrence except that iteration is presented in the so-called closed form. This means that the nth element in the series is computable directly from the initial values and n itself. This implies that the interface offered by Sequence is a random-access range, as opposed to the regular Recurrence, which only offers forward iteration.
>>
>>54098204
christ the lack of word wrap
here it is in readable format

Sequence is similar to Recurrence except that iteration is presented in the so-called closed form. This means that the nth element in the series is computable directly from the initial values and n itself. This implies that the interface offered by Sequence is a random-access range, as opposed to the regular Recurrence, which only offers forward iteration.
>>
>>54098203
reminder that the following tea cup is a valid D statement
q{Y};
>>
>>54098245
reminder that it can still be unambiguously parsed

also hey no it isn't
>urafaget.d(5): Error: string has no effect in expression ("Y")

what's it supposed to do? some kind of spooky enum declaration?
>>
>>54098274
q{valid tokens} is a specific kind of string literal

that should compile, try

"Y";
>>
>>54096914
Metal (Manowar, Judas Priest, Metallica,...), or electro (Dance With The Dead, Carpenter Brut, Macross?)
>>
>>54098311
Anon you have shit taste
>>
>>54098294
I see
>Token strings open with the characters q{ and close with the token }. In between must be valid D tokens.
this is for mixins I guess?

>"Y";
it wasn't compiling because a literal isn't a statement

writeln(q{Y});
should work though
>>
>>54097036
>I'm not a real programmer
time to leave then
>>
>>54098326
in C++ you can do this

"some string";
>>
>>54098335
but why?
>>
>>54097246
>salty
>>
>>54098339
Why not?
>>
>>54098347
well what does it do? Is it just one of those unfixable quirks of c++ or does it serve some purpose?
>>
>OP didn't ask what you're working on, and chose to shitpost instead
Well, I'm working on bash scripts to automate a bunch of rtorrent/rutorrent shit on my homeserver.
>>
>>54098354
I guess all expressions are valid statements in C++
>>
Who /java/ here?
>>
>>54097936
atm, blue. Sometimes, dark.
>>
>>54098364
what about
10;

?
>>
File: when the d on point.jpg (14 KB, 250x377) Image search: [Google]
when the d on point.jpg
14 KB, 250x377
>>54098376
java is dead
sepples is dead
memeskell is dead

long live the D
>>
>>54098392
Yeah, and

true;
>>
In Python:

need a function with a variable amount of arguments (i have that)

now i want to return something from a nested dict, like so:

def config(*args):
configfile = open("thing.conf")
config = eval(configfile.read())
configfile.close()[spoiler][/spoiler]

if len(args) == 0:
return config
elif len(args == 1):
return(config[args[0]])
elif len(args == 2):
return(config[args[0]][args[1]]


there must be a far better way to do this, please assist
>>
>>54098437
i know the bracket is missing, and i have no idea where the spoiler tags came from
>>
>>54098437
not sure what the python for this is:

eval ("(config"~
([0..len(args)] . map (i -> "[args["~i~"]]") . concat)
~")")
>>
>>54098444
so I'm not the only one

you must have instinctively pressed ctrl+s after you finished typing something
[spoiler][spoiler][spoiler][/spoiler][/spoiler][/spoiler]
>>
>>54098457
ah, that's actually pretty great, thank you, kind anon
>>
File: XUFFaR0.webm (1 MB, 294x520) Image search: [Google]
XUFFaR0.webm
1 MB, 294x520
Ask your favorite programming literate anything (IAMA).

>>54096898
Thank you for hime

>>54096916
Procedural abstraction.

>>54096953
>llist_t
>_t
Implementing a stack on a linked list is not interesting (or maybe if you want a lock-free data structure) since you will not access the node elements.

>>54097282
Kivy or enaml

>>54098437
a = config
for e in args:
a = a[e]
return a
>>
>>54098503
>a = a[e]
Is dynamic typing the future?
>>
>>54098503
nice
>>
Ask your favourite programming illiterate anything

>>54098510
yeah probs I mean it's less characters to type lmao
>>
>>54098524
kill yourself
>>
>>54098510
Pretty much everyone besides webfags and retarded snekfags agree that static typing is infinitely better.
>>
>>54098503
Should I write a json library in the C programming language? Am I stupid for doing so?
>>
>>54098573
could be ratified into static typing, basically just as a tree type
>>
>>54096898

Why did the ES6 committee elet to turn Javascript into Java? The class keyword will ruin the language....
>>
>>54098583
or as a predicate based type
t = a | (a | t)[e]
>>
>>54098581
If you can already find one, then yes. You are.
>>
>>54098604
*t = a | t[e]
>>
>>54098610
You sound like a webdev.
>>
>>54098569
haha that's not a question anon
>>
>>54098618
you said ask, and he made a request
>>
File: xkcd_wikipedian_protester.png (35 KB, 500x271) Image search: [Google]
xkcd_wikipedian_protester.png
35 KB, 500x271
>>54098581
there already many libraries for that but if you just want a personal challenge then go for it.

>>54098573
pic
>>
>>54098618
kill yourself?
>>
>>54098617
http://zserge.bitbucket.org/jsmn.html
>>
>>54098637
we did a strawpoll and it was 75%+ static typing

and it's fucking obvious anyway why static typing is superior, fuck you fucking disgusting shitter
>>
File: 25345232323242.jpg (65 KB, 750x750) Image search: [Google]
25345232323242.jpg
65 KB, 750x750
I'm trying to make a batch script(or whatever you call .bats on windows) with the arguments for clang/emscripten pause after running.
Putting in "pause" works as long as I don't run clang before for some reason. What do?
>>
>>54098593
>class keyword
oh shit webdevs are fucked lol

I can't even begin to imagine the eldritch horrors that will result from webdev stack overflow copy/paste development coming into contact with pajeet tier abstract interface object factory visitor shit
>>
File: 10367549.jpg (20 KB, 500x567) Image search: [Google]
10367549.jpg
20 KB, 500x567
http://strawpoll.me/7405997
http://strawpoll.me/7405997
http://strawpoll.me/7405997
>>
>>54098648
This is very nice and makes me want to write my own.
>>
>>54098666
>6 total votes
how is this thread so active when there are so few people here?
>>
File: more hax.png (92 KB, 820x385) Image search: [Google]
more hax.png
92 KB, 820x385
>>54098684
h4x
>>
>>54098690
I don't get it..?
>>
>2 votes for dynamic typing
REEEEE
>>
>>54098654

Exactly.

Prototypal inheritance was awesome. You only ever needed a base class when it became to share stuff. In a good JS program, you rarely see user created prototypes. Soon though, a simple two state button will probably end up with 3 subclasses...
>>
>>54098713
I guess sites are going to get a lot slower and more resource intensive all of a sudden

is there no stopping the cargo cult?
>>
>>54098706
some of them are voting just out of spite/for the lulz
>>
>>54097575
depends how you manipulate it afterwards.
>>
>>54098723
dynamic typing has advantages
>>
>>54098743
and crippling disadvantages.
>>
Never employed here.

What do people actually do when they work on 'enterprise software'? Like why does there need to be a team of a dozen engineers working 10 hours a day on some application for bank tellers?
>>
>>54098706
/wdg/ is leaking.
>>
>>54098743
they're very minor, don't outweigh the disadvantages, and are only relevant for pathetic webshit/scriptshit
>>
>>54098747
>>54098760

it's a convenience over subtyping
>>
>>54098750
>spend 90% of the day in standup meetings talking about how 'agile' you are
>spend 9% of the day shitposting on /g/
>spend 1% replacing the simple, concise and functional code you wrote for your prototype with a clunky, unmaintainable mess because management heard about 'object oriented best practices' and wants 'whatever that is'
>>
>>54098815
>>spend 90% of the day in standup meetings talking about how 'agile' you are

I actually despise the word "scrum" and I want to punch everyone who says it.
>>
>>54098853
we all do, tripfriend
>>
>>54098853
You're saying you want a scrum?
>>
>>54098882

I'll scrum all over your face, bb.
>>
>>54096914
Obviously depends on your taste, but I'd suggest something without too much going on.

I like metal but I don't get how one can listen without getting distracted by all the elements and noise while programming. With that being said, you still want something with energy.

Minimal techno, deep house, psy-trance, liquid dnb are all great (if you're into electronic stuff).

If you like like instruments, try indie pop. Find a dank compilation on YouTube.

Personally, I love MajesticCasual (YT channel, chill house).

Clams Casino, Ratatat, XXYYXX are also great. They're (mostly) instrumental.
>>
>>54098908
>Minimal techno, deep house, psy-trance, liquid dnb
lame as fuck
>>
>>54098908
>what is objectively ...
>obviously depends on your taste, but i like x,y,z | { x y z } ⊆ shit
>>
>ear infection
>in unbearable pain
kill me /dpt/
>>
>>54098938
*teleports behind you*
pshhh nice try, kiddo
*tips GNU/fedora*
>>
>>54098920
Please suggest better music desu.

>>54098927
It ain't hard nigga
>depends on your taste
>here's MY opinion
Get that sand out of your unshaven vagina
>>
>>54098753
/wdg/ here. Static typing is superior, unless you never work on 5k+ loc projects and only glue together frameworks of the month with left-pad.
>>
>>54098968
>ask for objective fact
>explicitly given opinion
Why are multi-reply-fags so cancerous?
Is it because they're obsessed with (You)s?
>>
>>54098982
>asks for music
>gets people's various opinions because MUSIC
>angryfaggotcrying(2).wav

How's being salty treating you?
>>
My C++ program keeps outputting certain calculated values as hex and not decimal notation. Is there a way to brute force this?
>>
>>54099008
http://en.cppreference.com/w/cpp/io/manip/hex
>>
>>54098360
This font is ugly.
>>
>>54099032
Thank you for the resource.

I simply forgot to mark down that one output as an array. So my bad completely.
>>
>>54099403
I disagree.
>>
just checking: simple yes or no is this:

 
while(tmp.next != null) tmp = tmp.next;

tmp.next = new Node<AnyType>(item, null);


the same as this ?
while(tmp.next != null)
{
tmp = tmp.next;
}
tmp.next = new Node<T>(t, null);
>>
>>54099455
Yes.
>>
>>54099455
both are disgusting and you're retarded
>>
>>54099455
Excluding the slight differences in the last line, yes.
>>
>>54099490
>>54099462

thanks

>>54099485
calm down turbo
>>
>>54099506
>>54099506
follow up question: when writing a linked list in java, is it good enough if I just 'nullify' the head and leave the rest of the job for the gc ? or should I make my
 linkList  
null ?
>>
>>54099559
Does you linked list leak nodes? If so, you should definetly clean up manually because otherwise people will keep references to the old list.
>>
File: 1458781767622.png (171 KB, 374x347) Image search: [Google]
1458781767622.png
171 KB, 374x347
How the fuck do I into sorting algorithms
>>
>>54099632
got it, thanks
>>
>>54099663
shove a dildo up your ass and google it
>>
File: we_are_shiba.png (667 KB, 640x640) Image search: [Google]
we_are_shiba.png
667 KB, 640x640
>>54099663
http://www.sorting-algorithms.com/
>>
>>54099663
Practice anon.
type 'a btree =
| Leaf
| Node of 'a btree * 'a * 'a btree
;;

let rec insert ( - ) item = function
| Leaf -> Node (Leaf, item, Leaf)
| Node (left, node, right) ->
let swap =
if node - item <= 0 then
(fun left right -> right, left)
else
(fun left right -> left, right) in
let left, right = swap left right in
let left = insert ( - ) item left in
let left, right = swap left right in
Node (left, node, right)
;;

let sort ( - ) l =
let tree =
List.fold_left (fun tree item -> insert ( - ) item tree) Leaf l in
let rec extract accu = function
| Leaf -> accu
| Node (left, node, right) ->
let accu = extract accu right in
let accu = node :: accu in
extract accu left in
extract [] tree
;;

let print_tuple oc (x, y) = Printf.fprintf oc "%d, %d" x y;;

let print_list l =
let rec loop oc = function
| [] -> ()
| [x] -> Printf.fprintf oc "%a" print_tuple x
| x :: xs -> Printf.printf "%a; %a" print_tuple x loop xs in
Printf.printf "[%a]" loop l;
print_newline ()
;;

let main () =
let l = [3, 1; 1, 1; 4, 1; 1, 2; 5, 1; 1, 3; 9, 1; 2, 1] in
print_list l;
let l = sort (fun (x1, _) (x2, _) -> x1 - x2) l in
print_list l
;;

let () = main ();;
>>
>>54099663
http://algoviz.org/OpenDSA/Books/OpenDSA/html/
>>
>>54099663
convert to judaism
>>
123 1 9

Anyone know how I can regex this to just get the middle number? The number lengths are variable.
>>
>>54096914
Classical
>>
>>54099934
Nvm figured it out

(space)\d+(space)
>>
ayy so I've been making a rhythm game in c# and I have falling lines to the beat of the music, but I've been wondering how I use buttons for that so people could actually play it. is that hard or easily doable? i'm bad at programming.
>>
complete starter here
i wrote some c++ code from a guide book
but it don't know how to compile and run it
which software is best for this? thanks
>>
>Tfw you had no one to teach you programming as a kid now it's way too much work as an adult
>Tfw no face
>>
>>54100142
>wanted to teach little brothers programming but they were more interested in playing gaymes
>>
File: transvisual.webm (217 KB, 1184x664) Image search: [Google]
transvisual.webm
217 KB, 1184x664
>>54096898
I made a tool to help me visualize translations and rotations. I setup whatever operations I want in an array which can then be stepped through so I can exactly what each transformation does. My original idea was to create a shader debugger but that's a much larger project than I care to admit. Also, the step descriptions are added manually so I could end up making mistakes there. I may want to generate the descriptions from the code somehow.
>>
>>54100142
it's easier to learn it as an adult because your brain is more developed. not literally "your" brain though.
>>
>>54100142
>Kids
>Programming anything
>>
>>54100172
It's easier to learn as a kid
>>
>>54100095
Visual C++ Community Edition
QtCreator
>>
>>54100077
You need a "Think" function that runs every frame that looks for input. Keyboard.IsKeyDown may be what you are looking for.

for keys in keybinds
if Keyboard.IsKeyDown(key)
keyToAction(key)
>>
>>54100077
i'd pay anyone who makes it 20 euros :^)
>>
>>54100185
as a kid you're too goddamn stupid to understand it properly. and there's no excuse why you can't learn it as an adult fucking lazy shitter
>>
>>54100185
niceme.me
>>
/dpt/, I need some advice.
I want to write a program that would quietly run in the background on a Windows PC and expose its filesystem to a remote server (allowing to view the directory structure and download files from it).

Basically I need SSH+SCP.
Does something like this exist for Windows? I'll write it if it doesn't, but I'd rather not.
>>
show me any example of a kid that picked up programming in a reasonable amount of time and learned it well enough to write professional-quality software. or any kid at all that can write GOOD software. even carmack's kid only did some very simple babby engine stuff, so your excuse of not having a teacher to spoonfeed you is moot.
>>
File: transvisual2.webm (542 KB, 1184x664) Image search: [Google]
transvisual2.webm
542 KB, 1184x664
>>54100171
I forgot to show that I'm able to rotate the scene around. I put the axis there for reference but for some reason I'm not able to make them long enough so that you don't see the ends of the lines when you rotate the scene around.
>>
>>54100168
>>54100180
Introduce them to Minecraft on the PC and all the crazy addons you can inject into that behemoth.
They might want to learn what a server is and how to run one, or even write addons for that hackjob.

Once they reach the teens, try Garry's Mod. Its Lua API is simple and approachable.

>>54100236
Install Linux in a VM and share with it whatever directory you need to access.
>>
>>54100189
thanks
>>
>>54100279
>Install Linux in a VM and share with it whatever directory you need to access.
Doesn't qualify as "quietly".
>>
>>54100279
One already plays Minecraft, but I don't think he would want to write mods. He's also able to run a nodejs server for agar.io.

I don't know if he uses garry's mod.

It's baffling how they waste their time playing old and ugly MMOs, at their age I was toying with N64 emulators and MIPS asm.
I'd still like them to completely drop Windows and learn the Unix Way©.
>>
>>54100310
So you're trying to write malware. Get out, script child. This website is for adults aged 18 and up.
>>
>>54100279
>Minecraft
>Garry's Mod
require('autism')
>>
>>54100077
>>54100203
anyone?
>>
Does anyone know a good algorithm for string searches? I need to do some memsearch, I'm using Bayer-Moore but I wonder if there's anything better out there
>>
>>54100394
https://www.google.com/search?q=cshart+keyboard+input
>>
I'm trying to learn git, and I'm not quite sure when to git commit on my small projects. Do you git commit on every irrelevant little change, or when you implement a feature with big changes?
>>
>>54100432
danke
>>
>>54100426
What kind of search are you doing?
>>
>>54100442
Each time I finish a task. You have to define what is a task.
>>
>>54100480
Search for a certain pattern in ram.
(embedded system)
>>
>>54100544
Regex or extended regex?
>>
Post some good D snippets.
>>
>>54100204
Plenty of reasons they are called responsibilities which you probably never heard of them
>>
>>54100580
Go home, Andrei, you're drunk.
>>
>>54100563
regex
>>
>>54100643
Matching regex is linear. Just open a book about regular language.
>>
>>54100580
>proprietary language
Not even once.
>>
Who here likes programming on there patio and then shitting in there backyard?
>>
>>54100683
POO
>>
If I'm making an application in C++ is it worth switching from pthread to some C++ threading lib? So far pthread works wonders.
>>
>>54100250
hope you're using quats anon
>>
>>54100683
>"there"
kill yourself
>>
>>54100920
You may consider std::thread from the standard library, it's mostly C++ wrapper around pthreads, so it's slightly easier to use without any advantages. Oh, and it's cross-platform, so you don't need winpthreads on Windows.
>>
I want to use an Android Device as camera on Wangblows for an app [:^)] what should i install?
>>
>>54100987
>Oh, and it's cross-platform, so you don't need winpthreads on Windows.
Holy shit thank you so much. Praise the C++ gods, I though I was gonna have to port my application to winpthreads, god knows porting BSD sockets to winsock is enough of a hassle.
>>
>>54100936
they're
>>
What makes you guys REEE the most about a programming language?
>>
>>54100930
I don't know how to use them, but I know what they are. I don't need them currently because my game will function like a top down shooter.
>>
>>54101163
Dynamic typing.
>>
>>54101163
Operator overloading, using const every other word, and angle brackets right next to parentheses, e.g. <>()
>>
>>54101176
>>54101217
Okay I am going to make a language that has
>Dyanmic typing
>Operator overloading
>Const every other word
>Angle brackets next to parentheses

What else?
>>
>>54101238
Case-insensitive symbols.
>>
>>54101238
semantic whitespace
>>
I'm bored out of my mind and I need a project to keep me off coursework, what do you suggest
>>
>>54101238
optional semicolons
>>
>>54096914
Eurobeat for keeping your heart warm, and your brain active.

https://www.youtube.com/watch?v=29o9I8AJuBE
>>
>>54101331
DO YOUR HOMEWORK or post it here
>>
Self teaching Python for work, its my first programming language.

How come when I make a Method I need to reference itself.

For example:
class Monster(object):
hitPoints = 1
color = 'yellow'
weapon = 'sword'
sound = 'roar'

def battlecry(self):
return self.sound.upper()


Then when I import it
from monster import Monster
bear = Monster()
bear.battlecry()


I just don't get why I have to reference "self". I THINK I understand why I cant just say Monster.battlecry(), which is because Monster isn't really an object, its just a class I can assign to objects, but I am lost on the "self" part.
>>
Someone have the clever Fibonacci program written in D?
>>
>>54101487
The answer is: Because Python's object system is objectively shit. Also I do hope you realize that all the fields that you defined in the class are shared between all instances of it.
Or in layman's terms: I you make five different Monster objects and reduce the hitpoints of one of them you reduce the hitpoints of all of them.
>>
>>54101429
it's just shit I have to study no actual programming that's why I don't wanna do it
>>
>>54101519
I did not know that.

What the fuck is the point of OOP then? There HAS to be a way around that right?

I just gotta keep telling myself its worth $5/hr more
>>
>>54101545
what the fuck is the point of python is what you should be asking
>>
>>54101545
>What the fuck is the point of OOP then?
The better question is: What the fuck is the point of Python?
>There HAS to be a way around that right?
Nope. Enjoy your shitty programming language.

But it's certainly worth the $5/hour. If your boss is such a dumbass that you have to use Python you can bullshit all problems away anyway.
>>
>>54101561
I donno. The sad thing is I am enjoying the process of coding, but Python feels gross, even as a newbie.

Once I get my $5/hr I might try C++ or something
>>
>>54101545
>>54101583
>There HAS to be a way around that right?
Wait, there is. You have to call all fields "self.hitpoints", and so on.

The other point "Enjoy your shitty programming language." still stands though.
>>
>>54101487
This is just Pythonic idiosyncrasy, most languages have self argument implicitly, otherwise it's the same. Basically, "Monster.battlecry(bear)" = "bear.battlecry()".
And don't listen to >>54101519, Python's object system is one of the best out there.
>>
>>54101519
>Also I do hope you realize that all the fields that you defined in the class are shared between all instances of it.
Have you ever used Python? You might wanna test that for yourself and prove yourself retarded.
>>
>>54101602
>Python's object system is one of the best out there.
0/10
>>
File: 1201827592279.jpg (71 KB, 562x437) Image search: [Google]
1201827592279.jpg
71 KB, 562x437
>>54101602
>Python's object system is one of the best out there
>>
File: umaruwp.jpg (112 KB, 1920x1080) Image search: [Google]
umaruwp.jpg
112 KB, 1920x1080
>>54101487
because it's the best and most correct way to define the procedural interface of an object. people saying otherwise probably never read any PLT literature on oop.
>>
>>54101619
>>> class a(object):
list=[]

>>> y=a()
>>> x=a()
>>> x.list.append(1)
>>> y.list.append(2)
>>> x.list.append(3)
>>> y.list.append(4)
>>> print x.list
[1, 2, 3, 4]
>>> print y.list
[1, 2, 3, 4]
>>>
>>
>>54101621
>>54101661
It it though, it's easier to use and more sane than anything you can find in alternatives like PHP, Perl or Ruby.
>>
>>54101688
killyourself
Thread replies: 255
Thread images: 36

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

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