[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: 24
File: daily programming thread2.webm (2 MB, 600x338) Image search: [Google]
daily programming thread2.webm
2 MB, 600x338
old thread: >>54625648

What are you working on, /g/?
>>
File: movement.png (47 KB, 534x508) Image search: [Google]
movement.png
47 KB, 534x508
>>54630928
Minecraft clone.

Just wrote some code for moving around the currently static voxel scene. I found out that mouse movement is horribly jittery when it's raw so I'm averaging mouse input over 4 frames right now.
>>
>>54630966
Why don't you write it in a real language?
>>
>>54630966
rad
>>
>>54630928
Finishing up a cleaning routine for Teknik Accounts.
>>
File: real_language.png (26 KB, 869x492) Image search: [Google]
real_language.png
26 KB, 869x492
>>54631002
I am though anon kun.
>>
rate this ARM code for copying a 32 byte block of mem:
INIT      ADR R1, BLOCK1-4
ADR R2, BLOCK2-4
ADR R3, BLOCK1+28

LOOP LDR R0, [R1,#4]!
STR R0, [R2,#4]!
CMP R1, R3
BNE LOOP
>>
>>54631061
nice, rate mine
memcpy(dest, src, 32);
>>
>>54631026
are you implementing your own backface culling or something?
>>
>>54631162
No I let opengl do backface culling. When non-air blocks are touching other non-air blocks, the touching sides are not visible so I'm setting a flag to not render those sides when I compile the VBOs.
>>
>>54631061
>not Aarch64
disappoint
>>
I'm shit at math. Are you guys shit at math also? I feel like I need to get better at math. How do I get better at math?
>>
What should I start looking into for general network programming in python.
Like HTTP clients and IRC bots.
Any libraries or resources in particular?
>>
>>54631197
http://ocw.mit.edu/courses/mathematics/

>>54631207
import socket
>>
>>54631197
https://www.youtube.com/watch?v=SlCRfTmBSGs
but yeah im pretty terrible at it
its not that i dont understand it, its just so goddamn boring
>>
>>54631197
Practice.

Study a geometry or number theory textbook and do the practice problems and you'll git gud.

>>54631219
Number theory is fun nigga
>>
>>54631207
learn sockets, and then look at the specification docs of whatever protocol you want to implement
or start writing your own
>>
I wrote a thread scraper. It's better than my previous one.
>>
>>54631207
for irc shit

 import socket
import signal
import sys
[\code]

if you want to do shit with packets

 import scapy [\code]

but if youre not on a linux OS good luck installing scapy properly
>>
>>54630966
Post it running i want to see your progress...
>>
porting my cheating library to be framework agnostic (currently only works with Directx9)
i had no idea writing a graphics abstraction layer was this painful holy shit
>>
whats a good way to parse arm assembly im looking to make a mini assembler. finite state machine?

how do i know the difference between
ldr blah blah
and

ldr:


with labels and such
>>
>>54631630
Check for the colon at the end?
>>
>>54631706
if its reading ldr r0, r0 and suddenly theres a : at the end it just suddenly scratches everything and goes "oh its a label now" but theres gotta be an efficient and generic way to interpret it
>>
>>54631766
prematurely check for semicolons at the end
>>
>>54631766
>>54631630
BNF.
>>
>>54631799
explain
>>
>>54631841
basically what I said
>>54631783
instead of parsing the whole thing from the beginning search for clues like a colon then break into tokens / skip
>>
>>54631849
>search for @ at start to determine comment
>search for : at end to determine label
>search for . at start to determine pesudo-command
>parse token-by-token as arm command

how do i know what order each thing should be checked in
>>
File: out-1.webm (2 MB, 800x608) Image search: [Google]
out-1.webm
2 MB, 800x608
>>54631408
It runs at a smooth 60 fps right now I just don't know how to record high quality webm video. Because VLC and Arista are bitches, VLC producing output with glitchy 11 hour long "duration" and Arista not working at fucking all, I had to use a sketchy online converter.

This looks a lot less than what it is. The scene you see here is actually made up of 4 1-by-3-by-1 chunks that each render with their own VBO. Splitting the scene's VBO up means that modifying a bit of the scene doesn't require recompilation of the entire scene. Not useful for this but useful for larger scenes. When blocks touch, the sides that touch are culled as you can see by the scene completely disappearing when I enter the blob of blocks rather than rendering the sides of the inner blocks.

There is saving to and loading from disk: this scene saves into four files: config.ss, 1.bin, 2.bin, 3.bin, and 0.bin.

Config.ss
(finiteworld (2 1 2) (1 3 1) (4 4 4 4) ((stone . 0) (air . 1) (grass . 2)))

The 4 4's are the length of each n.bin in shorts.
$ hexdump boringwold/0.bin
0000000 0002 0000 0001 0002
0000008

Each n.bin is run encoded, so that's 2 0000 blocks and 1 0002 block.

Tomorrow I'm going to add block picking so that the block in the center of the screen gets an outline drawn around it. This will allow me to program in block placement and destruction based on user clicks (I can already modify blocks at a location and partially recompile the scene). At which point if I wanna get up to minecraft classic levels of functionality it's create menus and add more block types, and support for transparent blocks.
>>
>>54631921
Looks pretty good!
>>
you could have something like a pre-check for colons in the next few instructions in a thread while parsing the already checked instructions, the order is up to you, try different ones and watch for performance
>>
>>54631921
MOJANG ON SUICIDE WATCH
>>
>>54631849
>basically what I said

No.
You write a BNF that describe the langage you're parsing so it helps you defining formally the procedures needed to parse that language.
>>
File: Untitled.png (44 KB, 1920x1080) Image search: [Google]
Untitled.png
44 KB, 1920x1080
>>54630928
hash extension demo for class, and learning ruby
>>
>>54632218
>all these buzzwords
try again and this time make sense
>>
>>54631630
Don't be a lazy fuck.
Formulate a proper grammar and use a fucking parser generator.
>>
>>54631921
Shit nigger thats pretty dank...
Got a github id like to watch your progress
>>
File: Konata-is-Hyped.jpg (291 KB, 1600x1000) Image search: [Google]
Konata-is-Hyped.jpg
291 KB, 1600x1000
Thank you for using lisp.
>>
>>54631002
Carmack already moved to Racket
>>
>>54631531
What game?
>>
"don't look up the answer on HN edition"

    void free_circularly_linked_list(struct node *head) {
struct node *tmp = head;
do {
struct node *next = tmp->next;
free(tmp);
tmp = next;
} while (tmp != head);
}



So apparently there's undefined behaviour here. I lost a fucking hour looking for it. Fuck C.
>>
>>54631921
Use OBS then just download ffmpeg and put a command to convert to webm
>>
>>54632630
obviously
>>
>>54632630
>Fuck C
Not C's fault you don't know the language, m8!
>>
>>54632743
Apparently C doesn't even know itself!
>>
>>54632780
You sound like an imbecile, no surprise there.
>>
>>54632630
whats undefined?
>>
>>54632813
the behavior
>>
>>54632819
go fuck yourself
>>
>>54632829
are you dumb or just pretending?
>>
51 posts in, and no shitposts yet.

Is this actually /dpt/, or have my fellow Americans just not woken up yet?

>>54631197
I've literally never needed math beyond basic algebra and a little statistical analysis.

That being said, I don't do any real-time graphics programming at all.
>>
>>54632630
Maybe tmp being freed without being checdked for NULL? But I dunno C so maybe that's not even UB.
>>
>>54632911
free(NULL) is defined
>>
>>54632800
See >>54632838
>>
>>54632894
No shit posts?
>>54632829
>>54632800
>>54632743
>>
>>54630928
>post non-trap thread early
>someone whines hard
>post trap thread early
>no one complains
gee what a surprise

kill yourself fag
>>
>>54632960
dont you guys have better things to do than argue about this shit single every day?
>>
>>54632630
you are not checking if head or tmp is not null thus tmp->next is undefined behavior.
>>
>>54633008
the code is undefined behavior even if head is not null
>>
>>54633038
why ? explain
>>
>>54633043
} while (tmp != head);
>>
>>54633058
i don't get it.
>>
>>54633067
head is not a valid pointer anymore
>>
I need to implement a noise filter in python2.
However, I can't use scipy, because I have no clue how to bundle it with the application.
What's the best way to filter this? I found stuff about kalman filters, but they seem to be better for 2D arrays.
And I don't seem to be able to find proper examples online
>>
>>54633080
and ? head is not deference here.
>>
>>54633103
it doesn't matter; just using the value is enough to trigger undefined behavior, just like reading an uninitialized variable
>>
is uninitialized variables as big of a problem in C++ as it is in C?
>>
>>54633119
not it's not, otherwise diff pointers would be illegal.
>>
>>54633122
Yes
>>
>>54633119
>just using the value is enough to trigger undefined behavior
what
>>
>>54633132
what do you mean by "diff pointers would be illegal"?
>>
>>54633160
"while (tmp != head)" reads the value of head, which is indeterminate, resulting in undefined behavior
>>
>>54633160
If you call free(head), to then use if (x == head) is illegal.
>>
>>54633167
>>54633180
sounds weird as shit
is there an explanation why?
>>
>>54633185
the standard says so; if I were to speculate I imagine it's done for efficiency reasons (like all other cases of undefined behavior in C) on a hypothetical platform that has hardware validation for pointers (ie. pointer values are tagged in the actual hardware registers as being memory addresses and trigger a hardware fault if the value of a register contains an invalid address -- eg. the memory page was unmaped by the implementation of free())
>>
>>54630928
Working on a Web API for an Android application at work
>>
>>54633132
>diff pointers
What are those?
>>
>>54630928
Lewd
>>
anyone has a link to the spreadsheet with all the free CS courses? remember it was top down organized
>>
How do I into Monads with using Maybe all the time?
>>
>there are people on /g/ who still think C is a useful language in 2016.
>>
>>54631197
>I'm shit at math. Are you guys shit at math also?
No. I'm reasonably good at math.
>I feel like I need to get better at math.
You probably don't unless you want to work for Wolfram.
>How do I get better at math?
Don't waste your time.
>>
>>54633628
>I don't know C but must post something and ran out of anime images
>>
>>54632626
working on the library now, but i have used it for CSGO and Overwatch so far
>>
>>54633250
You're correct but this is so obscure that nobody will write a compiler that makes use of it because it would break tons of programs.
>>
>>54633669
On what principles does it work?
>>
>>54631531
Can you even post it here?
>>
>>54633689
elaborate

>>54633696
why not?
cheating isn't illegal m8, its just against the EULA/TOS or whatever
>>
>>54633720
>why not?
The idea is that once the source is public it's only a matter of time until it gets VACd.
>>
>>54633720
Like, how does a cheating library work?
>>
>>54633726
weeell i doubt VAC would sig just the library, since a lot of legit programs work the same way (fraps for example)

>>54633727
something like this ->
compile cheat as a shared library (.dll)
inject it into a program
cheat hooks important API calls (usually to directx), and use it to draw shit ontop of screen usign the programs own DirectX device and context

lets say i wanna make a wallhack
all i have to do is follow the above steps, and in the hooked API call i scan the memory for players health, position etc, and then use that information to draw stuff in the right location
i can tell you where to get started if you're interested
>>
How do you spawn a process in C (Linux) without fork() (another process) and without it being attached to another current process? Something like CreateProcess() in WinAPI.
>>
>>54633671
>obscure
it's on the same level of obscurity as reading an uninitialized variable: you're reading the value of a pointer after free(), a pointer to an object that doesn't exist, ie. an invalid pointer; what meaningful value do you expect?
>nobody will write a compiler that makes use of it
that's what they said about memcpy
that's what they said about integer overflow
see a pattern?
>>
>>54633865
clone()
>without it being attached to another current process?
impossible
>>
>>54633865
>without it being attached to another current process
EVERY process, except PID 1, has a parent.
>>
>>54633904
>it's on the same level of obscurity as reading an uninitialized variable: you're reading the value of a pointer after free()
most people are treating pointers as uintptr_t with syntax sugar. And nobody expects
uintptr_t t = 1;
f(t);

(where f is not a macro) to modify the value of `t` itself.
>that's what they said about integer overflow
Maybe. But some things are so common that they eventually find their way into the standard. Such as casting via unions.
>>
>>54633907
>>54633924
Well how does disown work then? Like when you detach a process from the terminal and close the terminal the process keeps running?

Basically I want to write a program that launches another program, overrides a section of memory of the target program, and closes but keeps the launched program running.
>>
>>54632630
someone write the non-UB solution i'm too lazy right now and i don't use linked lists anyway
>>
>>54633949
>and closes but keeps the launched program running.
That will work just fine without you doing anything.
>>
in C++ which one is faster


if ((array[u] == -1 && child > 1) ||
(array[u] != -1 && low[*v] >= time[u])) {
is_critical[u] = 1;
}



or

if (array[u] == -1 && child > 1) {
is_critical[u] = 1;
} else if (array[u] != -1 && low[*v] >= time[u]) {
is_critical[u] = 1;
}

>>
>>54633949
PID 1 will take ownership of the process.
You can simply do
if (fork() > 0)
exit(EXIT_SUCCESS);

to 'daemonise' your program.
>>
>>54633990
They probably compile to the same thing or if they don't the speed difference is negligible.
>>
>>54633937
agreed, most people expect to write C without knowing C
>modify the value of `t` itself
t is not modified, weather it's an int or a pointer, it's impossible in C; just that the act of reading it is forbidden
>eventually
until it happens, the code as it stands now is undefined behavior and you don't have any guarantee a compiler optimization won't break shit up; why take the risk?
>>
File: 1458066599488.jpg (475 KB, 852x973) Image search: [Google]
1458066599488.jpg
475 KB, 852x973
What do you think is the average /g/entooman's level on this?

http://sijinjoseph.com/programmer-competency-matrix/
>>
>>54633989
Yeh but I need to spawn it detached first and retrieve the pid to use with ptrace(), do I use execvp, system, posix_spawn or something else?

>>54634003
Yep but that will deamonize my main program, I don't want that.
>>
>>54634031
>© 2016 - Sijin Joseph Designed on rtPanel WordPress Theme Framework.
I read that as Sijin Joseph Designated, I swear; what did you do to me, /g/?
>>
>>54634024
>why take the risk?
It's a bit like reading a bunch of bytes into an integer and ignoring the possibility for integer trap representations.
>>
Hillis-Steel-Algorithm in CUDA.
void inclusive_scan_Hillis_Steele(const Ray ray, float *scannedAngles, float *scannedAnglesBuffer)
{
__shared__ bool swap ;

if (threadIdx.x == 0) {
swap = true;
}
__syncthreads();

int stride = 1;
while (stride < blockDim.x) {
if (threadIdx.x >= stride) {
if (swap) {
scannedAnglesBuffer[threadIdx.x] = MAX(scannedAngles[threadIdx.x - stride], scannedAngles[threadIdx.x]);
} else {
scannedAngles[threadIdx.x] = MAX(scannedAnglesBuffer[threadIdx.x - stride], scannedAnglesBuffer[threadIdx.x]);
}
}

__syncthreads();
if (threadIdx.x == 0) {
swap = !swap;
}
__syncthreads();

stride *= 2;
}
}

>>
>>54633628
no many much anymore.
>>
>>54634100
Oh, my indentation is fucked up.
>>
>>54634031
Never seen the inside of a CS classroom but I'm log(n) in over half and n in all but a few. Feels pretty good.

Also:
>git more advanced than SVN
Literally Pajeet tier.
>>
>>54634089
"a bit" is the right way to call it, since that's merely implementation defined; the difference between implementation defined and undefined is that optimizations don't fuck around with implementation defined behavior: as long as your program worked on a platform, it will always work; if you read a bunch of bytes into an int on x86, you can always safely ignore trap representations, no future compiler update will have any impact on this; with undefined behavior, it's open season
>>
>>54634118
void inclusive_scan_Hillis_Steele(const Ray ray, float *scannedAngles,
float *scannedAnglesBuffer)
{
__shared__ bool swap;

if (!threadIdx.x) {
swap = 1;
}
__syncthreads();

int stride = 1;
while (stride < blockDim.x) {
if (threadIdx.x >= stride) {
if (swap) {
scannedAnglesBuffer[threadIdx.x] = MAX(scannedAngles[threadIdx.x - stride],
scannedAngles[threadIdx.x]);
} else {
scannedAngles[threadIdx.x] = MAX(scannedAnglesBuffer[threadIdx.x - stride],
scannedAnglesBuffer[threadIdx.x]);
}
}
}

__syncthreads();
if (!threadIdx.x) {
swap = !swap;
}
__syncthreads();

stride *= 2;

}
>>
>>54634147
>if you read a bunch of bytes into an int on x86
x86 is not an implementation. GCC and clang are implementations and clang would have been free to add trap representations.
>>
>>54634140
>>git more advanced than SVN
>Literally Pajeet tier.

Not an argument.
>>
>>54634221
>>>/qa/534854
>>
>>54634194
>clang would have been free
of course, and it would document that decision; but we're talking about likelyhood here (ie. taking the risk)
to clarify the point, implementation-defined impacts portability, undefined impacts correctness
>>
Just moved a clients wordpress site and lost their SEO settings. Trying to see if there is anything I can do for them.
By any chance do any of you know where they could have been backed up to? I just did a normal db backup and and a complete file backup.
>>
>>54633167
>reads the value of head, which is indeterminate
No, head is perfectly valid.
>>
>>54634435
>late in the conversation
>still wrong
>>
>>54634435
>was
ftfy
>>
>>54634435
Before your input on this can be considered, please state the size of your dick. Thanks.
>>
>>54634140
But anon, git IS more advanced than svn!
>>
Making minesweeper for class
Don't have access to my code right at this moment so I'm gonna do my best to describe
Having trouble generating the mines
I have a cell class
The class has a boolean value for whether it's a mine or not
There is a 100 item array of cells for the board
I need to generate 10 random but unique intergers that can range from 0-99
I can't seem to get them to be unique no matter what I try
at the moment I've been trying using a bunch of for loops, but I thought you guys might be able to help me out.
>>
>>54634739
Kids these days have never used SVN.
>>
>>54634140
>>git more advanced than SVN
where does it say that?
>>
>>54634751
because it's shit compared to git my friend, there is _literally_ no reason to use svn other than legacy reasons.
>>
>>54634757
Having tried git once >>>> being an SVN expert.
>>
>>54634031
This is one of the most disgusting dick stroking challenge I've seen
>>
>>54634745
You could do something like this
unique_randoms = []
while len(unique_randoms) < 10:
n = random.randint(100)
if n not in unique_randoms:
unique_randoms.append(n)


I don't know Java, but you should get the idea from it
>>
>>54634847
I'll give that a try
I don't get to my CS class until later so I'll have to wait and see
>>
>>54632630
>struct node
I hate it when normies don't typedef their structs
>>
>>54635015
Get a load of this llad.
>>
>>54635015
this

if it's a struct type that you'll be declaring variables of it should be typedefed
>>
>>54635063
give me one (2 (two) - (minus) 1 (one)) reason why it's justifiable to not typedef a struct in C.
>>
>>54632630
— The value of a pointer to an object whose lifetime has ended is used (6.2.4).

so it is. didnt know that before.
>>
>>54635086
Linus says so.
>>
>>54635103
Tell it to this worthless shit >>54634435
>>
>>54635015
>doesn't know C
normie...
>>
>>54635086
struct node *node;
>>
>>54635130
>but sizeof really is a function
m8...
>>
How the fuck do i print a file in Qt?
All i can find is print a string and a QImage

somebody point me to the right direction how do i do this
>>
>>54635178
What of it?
>>
>>54635190
>I'm literally retarded
lad...
>>
>>54635184
take a screenshot of the file and print it as QImage
>>
>>54635224
the thing is that inside the program i want to select a file and then print it
>>
>>54635256
the thing is you should set more realistic goals for yourself, like first learning a programming language
>>
>>54635224
kek

>>54635184
print the file to string and then print the string
>>
File: you;).jpg (5 KB, 234x230) Image search: [Google]
you;).jpg
5 KB, 234x230
>>54635290
>>
>>54635298
I thought about this but what about docx and excel files and rtf and all those files?
I don't think i can read all of them and then print
>>
>>54635353
proprietary file formats are off limits. only word, excel etc can print them
>>
So mktemp() is considered unsafe garbage and one should use mkstemp() which is okay but returns a file descriptor, I also need the path though, is there a way to retrieve the path from an fd?
>>
File: justdoit.jpg (9 KB, 456x320) Image search: [Google]
justdoit.jpg
9 KB, 456x320
>>54635374
I'll see what i can do then
>>
>>54635387
no
>>
>>54635387
Sure. man 5 proc.
>>
>>54635399
i'm just having a laugh m8. but it is more complicated because of the file formats. docx is a zip file but then there are files within that zip file that you have to read
>>
>>54635399
>>54635430
you could try looking through openoffice and libreoffice source code to see how they do it
>>
>>54635387
>I also need the path though
are you so fucking retarded you can't read the documentation of a function?
>>
File: 2016-05-18-104624_548x338_scrot.png (200 KB, 548x338) Image search: [Google]
2016-05-18-104624_548x338_scrot.png
200 KB, 548x338
hello /dpt/ I would like to introduce my new waifu, Rebecca :3
>>
>>54635483
>she
anon...
>>
>>54634789
It says that a beginner user will first learn CVS and SVN. And that should be the correct way as those are the oldest version control systems. Git though more popular now came later. An experienced user will use whatever the project has been using till now.
>>
>>54635533
>It says that a beginner user will first learn CVS and SVN. And that should be the correct way as those are the oldest version control systems.
Nonsense.
>>
>>54635465
Nowhere it states that mkstemp() returns the path in any way.
>>
>>54634745
http://www.javapractices.com/topic/TopicAction.do?Id=62 though you would want to always use secure random
>>
>>54635558
read it again, dumbass
>>
>>54635557
Instead of learning the most hippy thing it is better in using established systems first.
It is the reason universities first teach C/Python instead of e.g. Go/Julia.
>>
>>54634847
kill yourself
>>
>>54635600
I did, it doesn't mention the path at all.
>>
>>54635613
git is the industry wide standard

go/julia are just completely fucking irrelevant shitty shit meme languages, arguably shittier than python
>>
>>54635558
>>54635619

template argument will be modified, from what I understand you can read it from there. (man talks about the reason you are not passing template const)
>>
>>54635613
Go is a lot more established than Julia, the stabilitiy of the two cannot even remotely be compared.
>>
>>54635619
you're a retard AND blind?
>The last six characters of template must be "XXXXXX" and these are replaced with a string that makes the filename unique. Since it will be modified, template must not be a string constant, but should be declared as a character array
>>
>>54635638
>>54635669
thx
>>
File: 1462825777591.jpg (38 KB, 450x338) Image search: [Google]
1462825777591.jpg
38 KB, 450x338
>I just started using emacs
why the fuck did he make all the shortcuts so whacky? alt+w for copy? ctrl+y is paste? ctrl c/v wasn't good enough for you fat man?

also when I hit alt it brings up the ubuntu search, what do I do about that?
>>
>>54635685
>emacs
>ubuntu
you're not even memeing correctly, ubuntu is cancer
>>
>>54635685
Unless it's a ubuntu thing or something non-standard you can use more common Ctrl+Insert/Shift+Insert/Shift+Delete
>>
>>54635635
>git is the industry wide standard
Says who? Do big corporations internally use Git? Google uses Perforce for their private source base but Git for e.g. Android. Noobs are learning Git first as this is the trend. Public code will be in Git but that doesn't make it industry standard.

>>54635652
C is more established than Python too.
That isn't what I meant though.
>>
>>54635613
>Golang

Every single distributed course is using go
http://www.cs.cmu.edu/~srini/15-440/syllabus.html

The majority of universities the beginning course is Python, which is now changing back to Scheme (racket) because of all the problems of Python syntax (whitespace errors, the clusterfuck of Python 3.x vs 2x) the functional lang course is SML or OCaml and Go is being used for everything else.

t. TA asst for parallel algorithms
>>
>>54635685
Ctrl+C is already taken by the sigterm command
>>
>>54635720
>The majority of universities the beginning course is Python, which is now changing
even academics are starting to realize how fucking horrible python is
>>
>>54635720
Note Java still used for all the "Software Engineering" classes because all the junit tests/contracts you can write to prove correctness plus gigantic projects like ElasticSearch are using Java + everybody else still.
>>
>>54635720
Yep we used Go for the distributed course here too. Used Java for intro courses and Haskell/Prolog for the "functional" courses (really more like the random programming paradigms courses) though.
>>
>>54635720
Interesting. I used them as comparison only because both are young languages--Go is 6yo and Julia is 4yo.
>>
>>54635685
>also when I hit alt it brings up the ubuntu search, what do I do about that?
Keyboard settings -> backspace on 'key to show the HUD' to unmap left alt.
>>
>>54635776
Maybe I will have to take a look in Go again.
>>
>>54635685
>emacs
appeared in 1976
>ctrl c/v
appeared in 1983
>>54635711
>Ctrl+Insert/Shift+Insert/Shift+Delete
appeared in 1987, it's called IBM Common User Access
>>
>>54635802
alt+w/ctrl+y though? wtf?
>>
>>54635802
How did you acquire the knowledge of the ancients?
>>
>>54635685
>mad grasshopper
>why doesn't emacs have iCloud integration by default? REST API not good enough for you fat man?
>>
>>54635826
maybe the "easy shortcuts" were already assigned to functions deemed more important?
>>
>>54635796
Get Kernighan's gopl.io book

If you need network stacks, or parallel/multi thread/concurrency Go provides that in a memory safe way with a solid and simple standard library put together by veterans of C.
>>
>>54630928
I’ve always wondered, is this webm from an actual anime? I mean, are these subtitles legit or not?
>>
>>54635882
>When new programmers start at google they aren't good enough to write C. That's why we invented Go.
t. Rob Pike
>>
Just started using IntelliJ for Java after learning C# on VS and I have no idea what does what.
>>
>>54635796
I've used it a lot since that course, but desu it's got some real weaknesses. Outside of the specific domain it was intended for (web servers) you tend to run into some pains. I'm writing an interpreter in it right now and the amount of weird casting I have to do and error checking is absolutely killing me.

What is attractive about it is primarily the "go" keyword, channels being so "first class" in the language and the defer keyword. Obviously none of these are exclusive to the language, but compared to e.g. Java they are huge for reducing how verbose your shit is (compared to the "new Thread(new Runnable() {..." shit being able to just write "go doThing()" is an absolute blessing). If it weren't for this casting/error checking hell that I'm in right now I would call it my favorite high level language.

Unfortunately Rob Pike seems like he sniffs his own farts a bit too much because whenever someone brings up a valid suggestion for the language he always dismisses it because he thinks his opinions are worth more than everyone elses, so I doubt these problems will ever be fixed. I think there's room for both exceptions and generics in the language, but everyone else who likes the language seems to be against those because the führer has declared that they are bad. So instead of being able to write for example a generic "map" function like you find in any functional language you have to write the same loop over and over or use some garbage library that uses hacky reflection that's unmaintained and slow as shit.
>>
>>54635889
the subtitles are not legit
>>
>>54635889
The subtitles are legit, as in they came from an actual sub group.
It was the "fun" track tho.
>>
>>54635685
There's an option somewhere to change copy/paste to C-c/C-v
>>
What's the best way to find kids on the internet? I made a program and need to test it out and need volunteers
>>
>>54635906
Writing memory safe C is an NP-hard problem.

OpenSSH was written from the ground up by experts in cryptography and safe memory handling and yet it still has bugs like any other C program.

Daniel Bernstein who is probably the best C programmer in the world alive right now in terms of writing proven memory safe programs still has to fix occasional bugs in NaCl, so much so that he tells people to use libsodium implementations in memory safe languages.

tl;dr just use a memory safe language if djb or even openbsd can't even produce proven correct code in C, because none of us will ever have their domain knowledge.
>>
File: 1462889206110.png (197 KB, 450x338) Image search: [Google]
1462889206110.png
197 KB, 450x338
>>54635802
>>54635711
>defending the hotkey madness that is not used anywhere else
1983 was 33 years ago, ctrl+c/v is literally synonymous with copy/paste at this point, and that is not the only goofy hotkey. it's this adherence to archaic principles that keeps the free software movement in the dust.

is the inability to accept changes in one's surroundings symptomatic of anything?
>>
>>54635931
The generics things is beaten to death, they produced a final version of Go and that's it. Go is a specific tool for a specific domain of problems.

You can always fork it and cram in all the generics you want
>>
>>54636122
ctrl+c is taken by the SIGINT command, which terminates the program
>>
>>54636122
see
>>54636015
>>
>>54632615
He's still using C++ pretty much all the time. Carmack even said Racket is for beginners and that Haskell is superior
>>
>>54636122
wow, if only you could configure stuff like that in emacs!
>>
>>54634745
>100 item array of cells
Here's an idea which I don't know if it's stupid or not - using Fisher–Yates shuffle but only for 10 elements. (As in, create an array of 100 elements filled with indexes 0-99, swap random(100)th item with 99th, random(99)th with 98th, etc up to 10 times and the last 10 items will be contain 10 unique indexes for your cells array. It's sizeof(int)*N_cells additional memory but at least you don't need to regenerate the random number several times or do runs through arrays to check for matches.
>>
>>54636107
>Daniel Bernstein who is probably the best C programmer in the world alive right now in terms of writing proven memory safe programs
is that so
>>
>>54635931
lol its easy to write memory safe code don't be an idiot xd
>>
>>54636183
Except Carmack wrote a web server in Racket and tossed his C++ webserver into /dev/null
>>
>>54636122
>ctrl+c/v is literally synonymous with copy/paste
only in windows and a few other environments that cater to windows users
>>
>>54636206
:^)
>>
>>54636206
uhh meant to reply to
>>54636107
>>
>>54636208
I literally cannot stop sucking John Carmack's dick, everything he says (or that I make up) is God's word and provably correct.
>>
>>54636107
>NP-hard problem
you don't know what that means, do you?
>experts in cryptography and safe memory handling
this has to be bait
>none of us
speak for yourself, weeb
>>
is serialization only used for saving/loading to files or can it be used for passing around information inside the program?
>>
>>54636208
And then he wrote the entire Oculus SDK and Minecraft VR in C++ :)
>>
>>54636241
yes
>>
>>54636241
You can use it inside the same program but usually there's no point, why not just pass the objects themselves? It's useful for passing stuff to another program though.
>>
For my senior final in my pre ap comp sci class in my HS I have to make a space invaders clone game. With Java and I'm having trouble finding a tutorial that really explains how to do it. Also if I make a Java project in eclipse can I run it is j creator since that's what my instructor uses? Also most of the tutorials are of people using eclipse. Any tutorials or insight would be greatly appreciated.
>>
>>54633807
Please do.
>>
>>54636241
Obviously it is capable of that, but don't do it.
>>
>>54636183
I'm pretty sure he also said that, while Haskell is great to program with, its laziness makes it unsuitable for a lot of his work. Which is fair enough.
>>
Trying to automate the deploys of my Rails app/startup.

After reading the Lean Startup, my approach has changed. I have a bunch of ideas for random apps. I think I'm going to stop trying to polish my ideas and release basic shit and iterate on it than try to craft AAA shit from my bedroom.
>>
>>54636268
>>54636252
Yes, I know, I got it as a assignmentin a preinterview assignments.

So do I serialize it to a string and then deserialiaze it back?
>>
>>54636275
>pre-ap

nigga I didn't need to do something half as difficult for my AP comp sci class. Use eclipse because it's probably infinitely better than whatever your instructor is using.
>>
>>54636317
YAML is maximum comfy

oh wait this is /dpt/

REEEEEEEEEEEEEEEEE FUCK OFF WEBSHIT
>>
File: 110.gif (3 MB, 650x575) Image search: [Google]
110.gif
3 MB, 650x575
>>54630928
how does one construct a specific word counter from a string?
i.e some random string "asddks memeASD Memexd oagag"
And I need to find the lower case "meme" and the higher case "Meme" and then count them.


t. haven't slept for 18 hours and mind isn't working anymore
>>
>>54636325
Yes, but you just don't.
>>
>>54636359
delete this picture its making my willy nilly
>>
>>54634031
some of these are retarded
like it says you have to be proficient with an IDE it be a good programmer, but then it also says you should know how to use build systems and not the IDE's build system. what's the point of having an IDE if you can do everything manually?
or it talks about OOP design and then says they should use Haskell or Prolog instead of an OO language
>>
>>54636241
There are use cases for this.
>>
File: 1416829090001.jpg (210 KB, 683x1024) Image search: [Google]
1416829090001.jpg
210 KB, 683x1024
>>54636359
also they words should be added to array and answer needs to show in how many words does the phrase appear. Tried the .contains method, but that isn't case sensitive and .equals isn't what I need.

>>54636379
this pic gets attention tho, so it serves its purpose
>>
>>54636401
>this pic gets attention tho, so it serves its purpose

this one was better, the gif just made me all hot and bothered and so I didn't really want to respond to your question
>>
>>54636401
MOOOOOOOOODS!
MODS MODS MODS!
>>
>>54636359
are you using a C-like language?
iterate the whole string starting from the beginning, check if string[i] contains 'm' or 'M' since the word you are looking for starts with those. If it does, then look for an 'e', then for another 'm' and so on. that's a really rough approach.

If you are on a higher-level language you could just use a string method like contains() or substring() or whatever, really. You could approach it several ways.
>>
>>54636429
>>54636359

shit, forgot to say. I need this in java
>>
>>54636416
>it's not anime!!
>MOOOOODS MODS!!
>>
>>54636450
>animuuuuuuuuuu
>>
>>54636233
Show me any network facing daemon you've writting in C
>>
>>54636442
Do you expect us to write your code or..? What are you having trouble with?
>>
>>54636416
Its only a Barbi Dol
>>
>>54636381
I consider even mentioning "OOP design" to be incorrect at this point. Most of what "OOP design" should involve now is how NOT to fall into the traps that have been set up in all of the literature.
>>
>>54636464
I don't work for free
>>
File: Just Do It.jpg (23 KB, 500x418) Image search: [Google]
Just Do It.jpg
23 KB, 500x418
>>54632630
try declaring your head as a void node, if that doesn't work, try "malloc"-ing the tmp pointer in your cycle.
>>
>>54636466
no I don't, but some easy way or some method. Like I said, contains isn't case sensitive and that didn't work, I was wondering maybe some other method is. Going through each char is a possibility aswell, but I refuse to believe there isn't an more efficient way.
>>
>>54636486
In other word's you've never written one
>>
>>54636505
Did you think about downcasing (is that how you say it?) the whole string before using contains? If you are either looking for meme or MeMe that shouldn't be an issue.
>>
>>54636512
sure I did
>>
>>54636505
check out this guy's function for case insensitive search https://stackoverflow.com/a/25379180/6223442
>>
>>54636558
Well there are 2 types of memes in the random string, one starts with a capital letter and other one with a small letter. And I need to find in how many of those words that include that lower or uppercase word. example "MemeMeme asd" would give answer [1 ,0],
and "meme meme" would give [0,2]

So thats why I can't downcase the whole string, otherwise the information about the uppercase/lowercase would go lost. Or am I understanding you wrong, sorry I am not a native speaker and being up for a long time has quite an impact on your comprehension sense desu.
>>
>>54636645
Yup my solution wouldn't work, then.
I would probably iterate the whole thing checking each letter. Let's wait for a smarter anon to give us a clean solution though.
>>
>>54636679
hue I got the right solution all along. Apparently I was just iterating wrong things. Unbelievable seriously, I wasted so much time for such a dumb mistake.
>>
>>54636645
int smallMemes = count_memes(s);
int allMemes = count_memes(s.toLowerCase());
int bigMemes = allMemes - smallMemes;

shyggy
>>
>>54636725
>>54636679
Thanks guys, i'll be probably back soon with another question though.
Thread replies: 255
Thread images: 24

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.