[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: 38
File: 1443615325020.png (2 MB, 1200x1726) Image search: [Google]
1443615325020.png
2 MB, 1200x1726
Old thread: >>51318989

What are you working on /g/?
>>
Rate my array reversing function.
Rate my array reversing function.
void reverse(int *arr, unsigned size) {
int tmp[size];
int a = size - 1;
int b = 0;
while (a >= 0 && b <= size) {
tmp[b] = *(arr+a);
a--;
b++;
}
a = 0;
while (a <= size) {
*(arr+a) = tmp[a];
a++;
}
}
>>
>>51321769
4/10 uses loops.
>>
rewriting the haskell meme in java
>>
This is my 3rd /dpt/ since dinner, am I an addict?
>>
>>51321758
Perfectly serious question, but Swift is useless Apple garbage, and D is just FOSS C#
>>
>>51321773
how do you do it without loops?
>>
>>51321797
nah m8, /dpt/ isn't a drug.
>>
can someone make a new thread?
OP: >>>/lgbt/ is the place for your shit
>>
File: ss.jpg (11 KB, 225x225) Image search: [Google]
ss.jpg
11 KB, 225x225
>>51321803
>>
>>51321753
I'm creating a programming language.

I like to think of it as an inverse Objective-C in a way. I'm adding a basic CTypes-esque addition to standard Smalltalk, except at the language level rather than as a seperate module. So the C type system is exposed and usable, almost directly, thanks to my intention to generate C code that calls into a runtime for this. In fact, it is even feasible that I could include a 'C Expression' literal that would allow the assignment of the results of C expressions to be used directly within the Smalltalk side. Those C expressions will be treatable like Smalltalk ones via automatic boxing.

As well as that, I am taking a certain amount of influence from the functional and aspectual families of languages.

Right now I am working on the parser. So far it generates the tree for simple expressions, including nested ones. I may move on to declarations next, then statements, then higher-level ones like class and method definitions. Then I can work on code generation and the runtime.
>>
Daily reminder that if you aren't programming in a language that has AST macros, you are bad and should feel bad.
>>
>>51321937
Daily reminder that if you aren't programming in a language that has template metaprogramming, you are bad and should feel bad.
>>
>>51321937
Daily reminder that faggots like this aren't making any real software.
>>
>>51321753
Figuring out a way to reduce the amount of memory allocations in a program of mine. At the moment they take up something like 80% of running time.
>>
>>51321961
>templates
>good
This is what C++fags actually believe.
>>
>>51321971
Allocate a big pool at the beginning and manage the pool properly as you go along, potentially implementing some form of internal pseudo-GC.
>>
File: Screenshot_2015-11-12_22-20-21.png (18 KB, 1600x900) Image search: [Google]
Screenshot_2015-11-12_22-20-21.png
18 KB, 1600x900
Managed to get my program to translate LMC instructions into their equivalent numeric instructions.
Code's messy as fuck, but here it is
http://pastebin.com/jHLWzya9
>>
>>51321963
I'd rather jerk off to my superior language than make real software.
>>
>>51321753
what doujin is that from and is that a boy?
>>
>>51321982
Yeah, that solves half of the problem. GC is not necessary in this case because if the program won't find the solution in 5 minutes it almost certainly will never find it. There is one single function which is responsible for the rest. It is finding certain kinds of overlapping parts of a DAG and a lets say equation for simplicity, and creating new DAGs with those parts replaced with something else. I think I've got a solution for that but I need to think about it a bit more since the function is a bit hairy.
>>
>>51321986
If it's a choice between the two, maybe your language isn't so superior.
>>
>>51321987
mesu nized festival
>>
CHALLENGE: Implement `cat' in as few characters as possible in the language of your choice. Copy standard input to standard output.

I'll start: lex.
%%
>>
>>51322050
You could consider using a functional language here. Because the underlying immutable data structures are typically shared in functional languages you can probably get a decent amount of memory savings without having to hand optimize stuff.
>>
>>51322178
bash:
cat
>>
>>51322242
wut
cat
>>
>>51322178
Perl (0 characters):
map echo 1 2 3 4 | perl -pe ''
1
2
3
4
>>
>>51322178
#!/usr/bin/env bash
cat $1


$ ./cat cat
#!/usr/bin/env bash
cat $1
$
>>
>>51321753
>What are you working on /g/?
The official /dpt/ C toolkit: a state of art, general utility, C library written by the community of /dpt/. The contributions have been good so far. linked lists have now a clone operation.
>>
>>51322295
So whenever you add a new test function, you have to go and update that struct array too?

Do C programmers *like* to repeat themselves?
>>
>>51322311
C programmers just need to write a lot of code to stroke their egos.

They spend most of their time reimplementing features from better languages, what do you expect?
>>
>>51322178
in Go, you use io.Copy(os.Stdout, os.Stdin)

>>51322242
>>51322256
so, for some reason, [code ] doens't work for short strings.
>>
File: 1373662916812.jpg (171 KB, 600x400) Image search: [Google]
1373662916812.jpg
171 KB, 600x400
>>51322311
>So whenever you add a new test function, you have to go and update that struct array too?
sorry but that kind of implementation details is confidential.
>>
>>51322178
Brainfuck:

This is a comment. This brainfuck program is 0 characters.
>>
I'm using a flight tracking services API to make a 3d map of planes kinda like pic related. This is going to be my first legitimate project so don't kill me.

One of the first issues I ran into is the fact that there's no index for all the types of data you can use. You need to go to specific urls with parameters to find anything useful. I'll be using a few functions such as lat/long/altitude, speed, flightroute, etc, so I need to have specific parameters and run the authentication function before getting the data.
(This is written in python btw)
I made the URL a global var and used %s so that I can add onto it according to the local var in the function being called.

Here's the code (I've obviously removed the apikey and username)


import urllib2
import json
username = ('anon')
apiKey = ('Key')
apiURL = ('http://flightxml.flightaware.com/json/FlightXML2/%s'%mod)

#This is an authentication function to get access to the data.
def Auth():
passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
passman.add_password(None, apiURL, username, apiKey)
urllib2.install_opener(urllib2.build_opener(urllib2.HTTPBasicAuthHandler(passman)))

#This gets data about the aircraft such as the manufacturer and model.
def AircraftType():
#Basic auth handling to start
mod = ('AircraftType')
Auth()

#This is just a test.
req = urllib2.urlopen(apiURL + '?' + 'type=GALX')
f = req.read()
print f
AircraftType()

Unfortunately, I get a name error saying that mod isn't defined (because it's a local var, not a global one.) Does /g/ know of a fix? And before you go off saying shit like "figure it out on your own". I've tried concatenating it with several different methods and none have worked, this is strictly a local/global var issue. I've gone on forums, they just tell me to fuck off so fuck them. My friends that take comp sci don't know a work around so pls help me /g/. Will provide more detail if someone replies, at the character limit
>>
>>51322383
maybe start with something less ambitious if you don't see how to manage this
>>
>MSVC folds identical virtual functions that are never called by name (only via vtable) together
Holy shit, I never knew it did this.

I mean, it makes sense as a micro-optimization (less cache bloat), but holy shit it makes performance debugging a nightmare.
>>
>>51321897
>C
>objects
>thanks to my intention to generate C code

Congrats on reinventing Vala. :)
>>
>>51322406
I've done easier things but they're so boring that by the end I feel like I've accomplished nothing. I don't care if there are roadblocks, it's a learning experience, I'm totally doing this for fun.
>>
>>51322415
99% of optimisations can be turned off
>>
>>51322415
>>51322446
https://msdn.microsoft.com/en-us/library/bxwfs976.aspx
>>
>>51322383
Is there any reason why all your strings are in parens?

You should probably be using the requests library instead of urllib2.

Also, just do api_url = 'http://.../FlightXML2/'; then string concatenation. Like instead you call Auth('AircraftType') and in Auth you do passman.add_password(None, api_url + payload, ...)

Your programming is a little questionable.
>>
>>51322383
apiURL = ""
def AircraftType():
#Basic auth handling to start
mod = ('AircraftType')
apiURL = ('http://flightxml.flightaware.com/json/FlightXML2/%s'%mod)

???
btw, why are you wrapping strings in () ?
>>
>>51322446
>>51322453
At which point I'm no longer profiling my 'release' build am I?
I know how to debug with optimizations off, but I'm trying to hunt down performance issures, which is hard when instead of getting "1 call to Foo::Update, 1 call to Foo::Init, 1 call to Bar::Update" I get "3 calls to Bar::Update"
>>
>>51322178
main = interact id
>>
Writing a tty "simulator" . Seeing your text and cursor wrap around the screen is funner than I thought.
>>
>>51322295
Where can I get a copy to use?
>>
>>51322472
What's the issue with the folding?
>>
>>51322521
It's not a problem, just surprising and makes performance profiles very hard to read. My code is spending a large (~20%) of the time in one empty function, because it has become the generic "empty-body virtual".

Hmm, maybe I should refactor my code to stop calling all these empty init() implementations.
>>
>>51322472
can't you not simply disable this particular "feature" in your release builds?
>>
hey bros i need some help, ive been teaching myself python for the last month and i feel like i finally have a grasp of everything but i dont know what to spend my time working on, any suggestions for a noob like me?
>>
>>51322463
>>51322469
Thanks a lot, I just realized the parenthesis around the strings thanks for pointing it out, still getting used to python 3 and where to have parenthesis.

Also I'd use requests but when I looked for working with requests in python 3.x I really only found a few links. Urllib2 had a whole bunch so I assumed the community would be better in case I had any issues and had to check.
>>
>>51322583
but then my program will not be optimal and it will be my fault for not having the fortitude stick with it
>>
>>51322599
a celsius to fahrenheit converter
>>
>>51322613

Python 3 has no special requirements for placing parentheses around things except for the print() function which now requires parentheses.

You should be fine using requests with python 3.x as it supports up to 3.4 officially. You should be able to get help with it very easily either in here, on SO, in /r/learnpython or /r/learnpython's IRC channel.

I don't understand the problem you're having at all. What is the full stack trace?
>>
>>51322418
Vala is not, to my knowledge, based on a message-based object system as my plan is; Vala appears instead to use virtual tables despatch.
>>
>>51322564
You could look at the assembly, and compare it to the assembly of each individiual function
>>
>>51322622

c = float(input('c: '))
f = (c * 1.8) + 32
print('%0.1f c = %0.1f f' %(c,f))

>>
>>51322703

I know m8, It was just banter.
>>
>>51322491
So, literally a terminal emulator?
>>
>>51322751
trips go home
>>
>>51321811
You can do it recursively..
>>
>>51322699
>>51322383

Oh wait, I see what you're trying to do. So, first things first, string interpolation like that is ugly. If you want to do this the idiomatic python way you should use the string format method.

Now, the problem you're having is that you're initializing the variable within a function. That means that the variables scope is only within that function, when the function is finished executing it will no longer exist.

Now, there is an *evil* way to bypass this and it's they keyword global. If you do something like this:


mod = ""

apiURL = "http://flightxml.flightaware.com/json/FlightXML2/{}"

def AircraftType():
#Basic auth handling to start
global mod
mod = 'AircraftType'

#This is just a test.
req = urllib2.urlopen(apiURL + '?' + 'type=GALX')
f = req.read()
print f

AircraftType()

apiURL.format(mod)



It will bring the variable we defined in the global scope into the function and we can act on it directly.

BUT. You should know that the way you're going about this is all wrong. Global variables are not good and you don't want to use them. Rethink the way you're going about doing this to avoid needing one.
>>
>>51322615
I'm not telling you to disable all optimizations, just this particular one.. I guess there is a compiler/linker flag somewhere.
anyway, I have no idea about this stuff, so whatever.

>>51322613
I see you confused the parenthesis thing because of print vs print() as >>51322699 said, no? you should follow multiple guides or read someone else's code to see how other people do things. that way, you'll notice when you are doing something unneeded or odd
>>
Welcome to DrRacket, version 6.2 [3m].
Language: racket [custom]; memory limit: 1024 MB.
> (retard? >>51322751)
'merely-pretending
>
>>
>>51321769
Why do you create a new array? You just manipulate upon the first in order to reverse it. Exchange [0] with [n - 1], [1 with [n - 2] etc if the array size is even. If the arra size is not even, then it's the same steps but the middle element remains the same.
>>
does anyone actually here work as a programmer?
>>
>>51322501
release date is around end of 2016
>>
>>51322814
How can the rest of the /dpt/ community contribute to this?
>>
>>51322831
it's in works to be a botnet you can just ignore him
>>
>>51322831
/dpt/ community (me) is already contributing
>>
>>51322871
oh, so it's just you?
>>
>>51322295

what does it do? im confused
>>
>Win32
Is it possible to "attach" some user data to a hWnd (i.e. a pointer to my Window object)?

My WindowProc is tied to the class, and I want to callback to my C++ Window object.
>>
>>51322884
Trolls /dpt/. It's probably the same guy who did those benchmarks.
>>
>>51322968
Yes, windows have userdata and so do window classes.

Look up SetWindowLongPointer and GetWindowLongPointer
>>
>>51322813
I'm a 10-year Software Engineer, ask me anything.
>>
>>51322978
(alternatively make a global map)
>>
>>51322798
>retard?
>not retardp
Schemefags pls go.
>>
>>51321986
/g/ in a nutshell
>>
>>51322990
What's the worst thing about interns?
>>
>>51322977
never been a troll.
>>
fucking cant get my try and catch loop to stop looping. put in printlns to see how the method operates and it gets right to the end where it returns a value and then goes right back into an already closed and broken while true loop, i'm dying
>>
>>51322785
>recursion
>more efficient than loops
>>
>>51323083
this is what memes have lead programmers to actually believe
>it's not like stack bloat is important guyz
>>
>>51323006
retard? is objectively superior to retardp.
>>
>>51322990
do you hate your job
>>
>>51323059
anti-haskell fags btfo
>>
>>51323059
>eshell
literally why
it's the worst of all the term modes
>>
Programming noob here, I tried programming the binomial coefficient in Python, it worked good and I saved the file. Now every time I try to open it, IDLE crashes. Here's the code:

def binomial_coefficient(x,y):
q = 1
for i in range(1,x+1):
q=q*i
w = 1
for i in range(1,y+1):
w=w*i
r = 1
for i in range(1,(x-y)+1):
r=r*i
bc = q/(w*r)
print bc

x=int(raw_input("n="))
y=int(raw_input("k="))


Wut do?
binomial_coefficient(x,y)
>>
>>51323059
>GDC
wew
>>
File: sussman shig.jpg (71 KB, 500x375) Image search: [Google]
sussman shig.jpg
71 KB, 500x375
>>51323092
>not using a tail recursive optimized language
>>
static LRESULT CALLBACK WindowProc(_In_ HWND hWnd, _In_ UINT msg, _In_ WPARAM wParam, _In_ LPARAM lParam) {
auto window = reinterpret_cast<Win32::Window *>(GetWindowLongPtrW(hWnd, GWLP_USERDATA));
switch(msg) {
case WM_CLOSE :
window->Destroy();
return 0;
case WM_DESTROY :
PostQuitMessage(0);
return 0;
default :
return DefWindowProcW(hWnd, msg, wParam, lParam);
}
}

Am I doing this right?
Why is WinAPI so horrible?
>>
>>51321753
Source on OP image please.
>>
>>51323120
How do I display code like this?
>>
File: 1429017313721.png (239 KB, 512x512) Image search: [Google]
1429017313721.png
239 KB, 512x512
>>51323105
really ? what other mode is better ? i like how you can inline lisp expressions in the shell like, for example,

> ./benchmark (* 1024 1024 32)
>>
>>51323133
<code></code> tags, but [] not <> brackets.
>Being this new...
>>
>>51323120
Yeah, looks like it

WinAPI was designed by C programmers
>>
>>51321769
Time complexity: O(n)
Space complexity: O(n)

You could easily make the space complexity O(1).

2/10
>>
while(true){
System.out.println("input number");
try {
x = Double.parseDouble(input.next());
break;
}
catch (NumberFormatException ignore) {
}
}

am I missing something in the catch? it gets out of the while loop but then when it gets to then end of the method with the return of x it goes back to this while loop
>>
>>51323160
[, ]
>>
File: CrossEyedCat.jpg (83 KB, 799x685) Image search: [Google]
CrossEyedCat.jpg
83 KB, 799x685
>>51323160
>>
>>51323141
I really really like ansi-term in char mode, because it most closely resembles an actual terminal emulator, and in my experience is the only one that displays ncurses applications properly.

I don't use many ncurses applications other than aptitude and htop, but I like to make sure that the term I am using is compatible for future uses as well.

It doesn't have any elisp integration, but I can live without that for the sake of compatibility.
>>
>>51323175
>>51323178
print 'am i doing it rite?'
>>
>>51323180
https://www.masteringemacs.org/article/complete-guide-mastering-eshell#visual-commands
>>
>>51323285
Why go through those lengths when term works perfectly all the time?

I understand the appeal of elisp integration, but I am not keen on updating a list of commands every time I want to try out a new curses program or rely on eshell's ability to distinguish.

If I really want to send some evaluated elisp to a buffer, evaluating it in scratch or IELM, and yanking & pasting the result into the buffer I want would work fine.
>>
How do I delete an item from a pointer to a vector of pointers? My code is:
for (vector<Object*>::iterator i = Singleton::getTheInstance()->getObjects()->begin(); i != Singleton::getTheInstance()->getObjects()->end(); i++){
delete (*i);
}


But I don't think they're actually being deleted. My memory usage doesn't go down, and the vector.size() doesn't change.
>>
Have you written anything that is actually useful, /dpt/?
Do you use anything you wrote on a regular basis?
>>
>>51323457
Calling delete on a pointer doesn't affect the pointer, it just calls the destructor of the thing pointed to and frees the memory.

Delete the pointer and then remove it from the array. (If you were using RAII, e.g. smart pointers, they could delete automatically when removed.)
>>
File: 1446781286563.webm (954 KB, 1920x1072) Image search: [Google]
1446781286563.webm
954 KB, 1920x1072
>>51323553
>>
>>51323553
>Do you use anything you wrote on a regular basis?

I use my music player and image viewer every day, pretty much.
>>
>>51323553
I made a terminal-based Assembly reference guide
Stopped working in it because a) putting in an entry for an instruction is a pain and b) I decided to hold off on assembly for awhile
>>
File: scmus.png (13 KB, 484x292) Image search: [Google]
scmus.png
13 KB, 484x292
>>51323553
I wrote an mpd client that I use all the time.
>>
>>51323621

That's because music is life, my man. You ever just wonder what's wrong with people when they say they never listen to music?
>>
>>51323457
Go back to Java, retard.
>>
>>51323677
kek i just noticed
>>
>>51323621
>mpd
bloated shite

install cmus
>>
>>51323723
literal scum
>>
File: 1421880559116.png (70 KB, 636x683) Image search: [Google]
1421880559116.png
70 KB, 636x683
>>51323553
I wrote a backlog manager in C.
I use it to keep track of all my anime.
>>
>>51323553
I wrote a program that fixed the creation date and file types of images in a group of folders so I could read manga on my psp (since it's ordered by creation date and some image files don't work for some reason).
>>
>>51323761
>he thinks he can keep track of his anime
>>
bklg -ls

http://pastebin.com/K8c3ktXe

fite me.
>>
>>51323797
Mean for >>51323774
>>
>>51323797
>Himouto! Umaru-chan
>>>/trash/
>>
File: Guido_van_Rossum-new.jpg (8 KB, 394x296) Image search: [Google]
Guido_van_Rossum-new.jpg
8 KB, 394x296
>>51323107
>IDLE
>>
>>51323815
I put it there when it first appeared on /a/.
I think i will trash it afterall considering how cancerous it seems now.
>>
>>51323808
absolute trash

>steins gate not rated 10/10
>no gintama
>no one punch man
>no kara no kyoukai
>no fate
>no fma
>no hellsing
>>
>>51323553
I wrote a program for distilling my porn.
>>
>>51323844
what does distilled porn look like?
>>
File: mpd-cmus.png (3 KB, 369x58) Image search: [Google]
mpd-cmus.png
3 KB, 369x58
>>51323723
cmus is good, but mpd is simply better.
>bloated
They're about the same (pic). Normally I have my mpd client closed so mpd is somewhat less bloated in that sense.
>>
>>51321963
>my language is shit, but I made YET ANOTHER X window manager! AWESOME! Next up, YET ANOTHER mail reader! I'm not wasting my time! This one will have vim binds! I'll be a desktop thread star yeah!
>my language is superior and i'm currently working on trading algorithms instead of pointless programs. why make more programs if macs already have everything you need? geeks.
>>
>>51323857
Like regular porn, but with the most arousing pictures in a separate folder.
>>
>>51323861
mpd took me literally all day to build.

cmus with complete plugins finished in 10 minutes.
>>
>>51323867
Do you hate fun or something?
>>
>>51323877
how do you quantify arousal?
>>
>>51323885
User input.
>>
>>51323881
I'm not going to pretend I'm a badass academic with a macbook air and access to an cluster of PS3s. I'm a thinkpad using non-mathematician just like the rest of you.

It's just a shitpost to highlight the possibility of someone with a 'useless' language getting something important done
>>
File: smugduck.gif (2 MB, 400x225) Image search: [Google]
smugduck.gif
2 MB, 400x225
>>51323892
Surely you could measure user output for that?
>>
>>51323880
Can't say I've had this problem, and I'm a gentoo user.
>>
>>51323797
>2: Yuru Yuri - 9/10
>13: Lucky Star - 6/10
>62: Himouto! Umaru-chan
thank you anon, thank you.
>>
>>51323843
Sorry, i have good taste.
>>
>>51323927
t-r-a-s-h
>>
>>51323909
Once you're going there isn't a whole lot of stopping, so distilling porn to a satisfactory point would take longer than distilling alcohol by staring at it really intently.

It would help if your program could sort things into "starters" and "good once it's going", and save that data in a form a special image/video viewer could use in conjunction with a phallometric device
>>
>>51323927
>>51323933
holy shit all of your anime is just of little girls
what the fuck is wrong with you
>>
>>51323933
Your taste that is.
>>
>>51323945
it means he's a lonely loser instead of a manchild, therefore he is superior to you, because he doesn't remind himself of how he was in highschool
>>
>>51323945
>what the fuck is wrong with you
I happen to have good taste is all.
>>
>>51323951
?

>>51323953
Hopefully the NSA are tracking you
>>
>>51323553
I wrote a static site generator for my blog
>>
>>51323968
Anime about cute girls isn't illegal m8.
>>
>>51323797
>currently watching
>nothing
>>
>>51324013
Well i just finished watching Working S3, and I'm not some retard who multiplexes anime.
>>
>>51324022
https://www.youtube.com/watch?v=qZtH0jcQI_w
>>
>>51324022
I am watching like 8 different anime as they air.
>>
about to tell a fridge joke
better start running
>>
>>51324045
Were you the one who uploaded this to my file server?
>>
File: 53044090_p0[1].png (746 KB, 1031x1347) Image search: [Google]
53044090_p0[1].png
746 KB, 1031x1347
>>51324022
>this guy doesn't even watch 10 episodes all at the same time
Are you even trying to be Prince Shotoku?
>>
>>51323761
Have you released it as Free Software?
>>
daily reminder that /dpt/ is and has always been an anime thread founded on anime-manga principles
>>
>>51324116
Fuck off linus you commie
Go home and vote sanders
>>
>>51324116
It's sitting on my local git server, but i can license it under MIT and upload to github if you really want it.
>>
File: everyone's connected.jpg (44 KB, 1008x720) Image search: [Google]
everyone's connected.jpg
44 KB, 1008x720
>>51323797
>12: SE Lain - 3/10
>>
>>51324139
It was shit, deal with it.
>>
How does git cloning of SSH work?
How does the server stop the client from just executing arbitrary commands?
>>
>>51324159
s/of/over/g
>>
Why the unicode chars don't work with urxvt despite using the same font than emacs where those unicode chars works fine ? Does emacs uses a different font for unicode ? how can i verify if a font has the requested unicode characters ?
>>
I'm reading this now. It's all your fault, /g/.
>>
>>51324195
Font is fine. Text encoding doesn't match.
>>
how bad of an idea would it be to develop on a VM?
>>
>>51324159
Probably with scp. I also imagine git repo servers also run some special ssh server to accept users, usually named git. Try reading the source code of one like gitlab
>>
>>51324250
Not a bad idea at all, infact it's really fun.
Go ahead.
>>
>>51324257
i feel like your joshing me son
>>
>>51324274
I'm being serious though.
Writing a VM is actually pretty fun, I'm doing one aswell.
>>
>>51324116
>>51324131
Here you go: https://github.com/sora-chan/bklg
>>
>>51324285
He asked about developing ON a VM, not developing A VM.
>>
>>51324359
oh, my bad.
It would probably be more convenient to develop on a VM than on real hardware.
>>
>>51324232
Enjoy your outdated programming practices and poor examples/exercises, fagget.
>>
>>51324353
$ make
clang loader.c -c --std=c11 -Wall -Wextra -pedantic -Wno-gnu-zero-variadic-macro-arguments -Wno-format-security -march=native -mtune=native -g -O0 -fsanitize=address
make: clang: Command not found
makefile:17: recipe for target 'loader.o' failed
make: *** [loader.o] Error 127
$ cd .. && rm -rf bklg/
>>
>>51322295
what is this godlike font? I want it.
>>
>>51324432
>make: clang: Command not found
you fucking autist you don't have your Apple iCompiler installed.
>>
>>51324432
Install Clang you luddite retard, also that's the debug build.
Type
make release
to build with gcc and debugging off.
>>
>>51324443
acorn nostalgia
>>
File: high-caliber-retard.jpg (99 KB, 579x960) Image search: [Google]
high-caliber-retard.jpg
99 KB, 579x960
>>51324432
>>
File: c_subset_of_cpp.png (40 KB, 1620x774) Image search: [Google]
c_subset_of_cpp.png
40 KB, 1620x774
Why do you still program in C++, /g/? Do you think you know better than Ken Thompson, Rob Pike, Dennis Ritchie, Linus Torvalds, Alan Kay, and Uriel, who have expressed disdain toward it?
>>
>>51324455
$ ./bklg -help
Note:
Couldn't open /home/anon/.backlog (maybe it doesn't exist?)
You can force the creation of this file by passing -forcewrite
....
$ ./bklg -forcewrite
Unrecognised argument: -forcewrite
$ make clean && cd .. && rm -rf bklg/
>>
>>51324159
You set the user's login shell to git-shell, which only allows execution of git commands.
>>
Should I use K&R to learn C? I've heard it's a little outdated. If so, what would be better instead or in addition?
>>
>>51324489
Fixed.
>>
>>51324537
Fix your fucking codebase.
also
>not using stdarg.h

What the fuck are you doing?
Also what the fuck a
>>
>>51324555
>>not using stdarg.h
Why? where?
>Also what the fuck a
what the fuck a what?
>>
>>51324571
You wrote an ugly if-else structure to handle your commandline flags.
That's what stdarg.h is for, dummy.
Learn to C, you make all C users look bad.
>>
>>51324582
>That's what stdarg.h is for, dummy.
I thought it was to handle ... in function calls, that's what i've only ever used it for anyway.
How would you use it to parse command line arguments?
>>
>>51324582
I don't know how you're so bad.
You're probably thinking of GNU Optparse.
You should not throw stones in glass houses - the most embarrassing here is your attitude and it's reflections on other C programmers. Get with the programme.
>>
>>51324605
err, GNU Getopt.
http://www.gnu.org/software/libc/manual/html_node/Getopt.html
>>
>>51324605
>GNU Optparse
>GNU
Lol no thanks.
I would much rather my ugly if-else block than any GNU shitware.
>>
>>51324617
Sure, I don't mind what you pick, but his hurfing and durfing is doing my head in.
>Can't install clang
>Doesn't know what stdarg.h is
>Calls out other people on learning to C
Fucking embarrassment.
>>
is this bad code because it somewhat uses exceptions for flow control?
on one hand, failing to open a process for some reason does qualify as an exceptional event and would just return an error code instead if coding without exceptions
one the other hand, i expect this to fail quite often (user hasn't opened the target process yet, etc)

bool exit = false
while(!exit)
{
try
{
Process proc = Process.open("notepad.exe");

while(proc.isOpen())
{
//Dostuff
}
}
catch (const OSError& err)
{
printf("Process not found or could not be opened. Retrying in 3 seconds");
}

//Sleep
Sleep(3000);
}
>>
File: the fuck am i reading.jpg (14 KB, 300x171) Image search: [Google]
the fuck am i reading.jpg
14 KB, 300x171
>>51324477
>Uriel
>>
File: Uriel.png (109 KB, 500x375) Image search: [Google]
Uriel.png
109 KB, 500x375
>>51324818
He tried to warn us, /g/...
>>
File: wut.png (152 KB, 1038x722) Image search: [Google]
wut.png
152 KB, 1038x722
Emulator dude from like 10 months ago lol.

Still working on the emulator (now with another person) but so far it shits the bed. There's a fuck tonne of opcodes to go through, so it's going be a massive bitch to debug... From the looks of it, it's writing a bad value to address pointed to by HL, but I'm not 100% sure why/where.

Pic related, the emulator shitting the bed...
>>
>>51321937
Daily reminder if your language is not multi paradigm, it's shit.
>>
>>51323553
Some bash scripts, an MP3 restreamer server for Ustream and an imageboard. All used regularly.
>>
>>51324925
C programmers think "multi-paradigm" means procedural AND imperative!

Also, you're triggering me. Please use the progressive term "heteroparadigm".
>>
>>51324925
If a language tries to incorporate everything in it, the programmer is more likely to fall back to using its "bad" features.
>>
I think C++ is a bad language. It does a lot of things half well and it's just a garbage heap of ideas that are mutually exclusive. Everybody I know, whether it's personal or corporate, selects a subset and these subsets are different. So it's not a good language to transport an algorithm- to say, 'I wrote it; here, take it.' It's way too big, way too complex. And it's obviously built by a committee.

Stroustrup campaigned for years and years and years, way beyond any sort of technical contributions he made to the language, to get it adopted and used. And he sort of ran all the standards committees with a whip and a chair. And he said 'no' to no one. He put every feature in that language that ever existed. It wasn't cleanly designed; it was just the union of everything that came along. And I think it suffered drastically from that.
>>
>>51323553
A mumble bot/file host.
My friends and I use it hourly.
>>
>>51323985
pedophiles actually believe this
>>
File: example.png (3 KB, 205x181) Image search: [Google]
example.png
3 KB, 205x181
I can't figure out how to solve this /g/.
So I'm programming a game where you can shoot bubbles
The target bubbles are saved in a 2d array, some spots are filled with a bubble and some are null.
After I detect collision, I pass the target bubble and projectile to another method.
I want to add the projectile to the closest null spot in the array.
The bubbles, projectile and the target all have x and y properties.
I could solve this by replacing the null fields by invisible bubbles and then calculating the closest distance, but this seems like a sloppy solution.

>pic related is an example situation
Any help is appreciated.
>>
>>51324841
>gameboy emulator
>instead of superior amd64 emulator
ishyggydiggy
>>
I want to install my first IDE (on Windows).
I'll be using it for C++/C# and Python development.
I'm thinking between VS or Code::Blocks.
Any suggestions/ opinions?
I don't want to do IDE hopping.
>>
>>51325293
If you're going to do C# and C++, you can't got wrong with VS.
>>
http://www.forbes.com/sites/timothylee/2013/03/26/how-gay-marriage-is-like-lisp/
>>
>>51325293
VS obviously, why would code blocks even be an option?
>>
>>51325535
what the f#
>>
>>51323147
>WinAPI was designed by C programmers
>Not assembly programmers

Seriously, programming Win32 in x86 assembly is beautiful. I'm not even joking, it just makes so much sense that way.
>>
>>51325758
that's nice but could we get some official high level apis for languages not owned by microsoft

also why is 64 bit windows also called win32
>>
>>51325771
Because they won 32 times.
>>
How much more programming do I have to do until I get paid?
>>
>>51325806
None
>>
New milestone for the official /dpt/ c toolkit: Arraylist has been implemented.
>>
>>51325806
You'll never get paid, you'll always have impostor syndrome.
>>
>>51325865
That's not the official one, this is just a plebian fork of a true project.
>>
>>51325865
we've been through this, post code or get the fuck out
>>
>>51325865
>official
no
>>
>>51323553
does shit i wrote at work count?

if not, then no
though im releasing a library pretty soon but i'm pretty sure it will just drown in the sea of other libraries that accomplish the same thing
>>
>>51323553
other than a few perl scripts that automate some things

anything that I write that is supposed to be useful is either riddled with bugs or don't work right.
>>
>>51323006
Welcome to DrRacket, version 6.2 [3m].
Language: racket [custom]; memory limit: 1024 MB.
> (retard? >>51323006)
'full-retard
>
>>
>>51325895
Where is the true project located?
>>
>>51326091
NeetCode.xyz, I'm in class just now or I'd dig it up
>>
Sitting in my advanced C++ course right now bored as hell.. What do?
>>
File: umarusfs.jpg (115 KB, 1280x720) Image search: [Google]
umarusfs.jpg
115 KB, 1280x720
>>51325895
huh ? which one ?
>>
>>51326102
Doesn't seem to be listed in the repo list?
>>
File: umarusummer.jpg (56 KB, 848x480) Image search: [Google]
umarusummer.jpg
56 KB, 848x480
>>51326161
tfw 3/4 of the repositories are mine
>>
File: IMG_20151113_132442.jpg (1 MB, 4160x3120) Image search: [Google]
IMG_20151113_132442.jpg
1 MB, 4160x3120
>25m into lecture
>prof nowhere in sight
>ironic staff login screen
Not going to lie, not getting a lot done today.
Who else attends a shit uni?
>>
>>51326123
Be happy you get to learn C++ in your uni. We just learn java and python.
>>
>>51326250
profs are lazy ass bitches who get tons of money for almost nothing
>>
>>51326250
>chromium
at least it's not chrome but still
>>
>>51326250
Can't you guys put in a trashbag correctly?
>>
>>51326257
They teach Java as all of the required courses. However, C++ is an elective.

I really wish we had Python, that'd be cool.
>>
>>51326276
>facilities goons can't do their job
I said I was at a shit uni
>>
File: IMG_20151113_134212.jpg (1 MB, 3120x4160) Image search: [Google]
IMG_20151113_134212.jpg
1 MB, 3120x4160
He's here!
>>
>>51326384
yay. what class is this
>>
>Move window
>Message proccessing stops, program freezes.
Fuck you too windows.
How the fuck do I fix this? I can't rely in WM_PAINT messages still getting pumped because they don't as of Vista/7.
>>
>>51326384
>Running i3
Muh nigga!

What website is that?
>>
>>51326392
Algorithms and Data Structures. The first time we're learning about this, big-O, linked lists, etc, fundamental stuff? 3rd year.

>>51326401
Our student developer/computer society slack instance. I was dead set on using IRC for our chat platform but the normies outnumber me :(
On the flip, in this row, there are two X220s and a T430. Thinkpad strong.
>>
>>51326415
wow really? First year for us.
>>
>>51326429
Yeah, it's shit. We're basically a jumped up polytech, USA would basically consider us a community college. We have great employment stats (~95% employed within 6mo of graduation in industry) because we can reliably churn out uninteresting Java/C# code monkeys.
>>
>>51323117
haskell fags not welcome
>>
>>51323723
qft

Cmus is love, cmus is life.
>>
>>51321769
dont reverse, just read it backwards
learn to use iterators
>>
>>51326493
but the question was to reverse the list in place.
>>
Bash question, for my linux box.

The following will list all of the files in my 'downloads' directory.
ls ~/downloads


The following will show only json, pdf, and txt files:
ls \
~/downloads/*.json \
~/downloads/*.pdf \
~/downloads/*.txt


Is there a shorter/smarter way to accomplish this listing?
>>
>>51326384
This gives me anxiety.
>walk into a classroom
>everybody is sitting next to somebody
>oh god where should i sit
>a guy on one side of the classroom recognizes me with a head nod
>another guy on another side does the same
>oh god where should i sit
>i could sit alone up front next to the lectutrer
>no that would look too nerdy
>there are no sits that are close enough to the people i know but far enough from the people i dont know
>i dont want to bother people by sitting next to them
>oh god where should i sit
And that's just my thought process every time i need to find a place to sit.
Imagine how horrible i feel every time i need to talk to people.
>>
>>51326512
Just pick any random seat, if you're interacting with the folk next to you, you're not learning.
>>
>>51326511
ls ~/downloads/*.(json|pdf|txt)
Thread replies: 255
Thread images: 38

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.