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

/dpt/ - Daily Programming Thread

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

Thread replies: 321
Thread images: 53

File: tmp_22391-1484152575123-3671072.jpg (675KB, 940x822px) Image search: [Google]
tmp_22391-1484152575123-3671072.jpg
675KB, 940x822px
What are you working on, /g/?

Old thread: >>58651763
>>
>>58656123
How to git gud ?
>>
File: dan.jpg (42KB, 270x270px) Image search: [Google]
dan.jpg
42KB, 270x270px
>>58656123
>when you realize Javascript is the best functional language
>>
>>58656123
Thank you for using a Ritsuko image
>>
rewriting the linux kernel in F#
>>
File: scip.jpg (41KB, 387x499px) Image search: [Google]
scip.jpg
41KB, 387x499px
Have you read your SCIP today?
>>
>>58656167
lol it's true
>>
>>58656123
I'm working on a browser game. And I'm suffering since JS lacks features like ADTs, but PureScript is still too hard for me.

By the way, are there any free "proxy" services available to make my stuff public? I want to serve initial version of my game from my own PC, but the ISP doesn't provide any public IPs for the local network.
>>
>>58656123

Neural net experiments.
>>
>>58656167
>not haskell
>>
>>58656167

What do you think of Scala?

I think JS is just accessible...
>>
>>58656363
Functional language which lets you get your shit done > Purely functional language.
>>
How the fuck does git work with multiple people working on the same project? Say I'm working on feature a and someone is working on feature b and they are their own branches from a develop branch. A gets merged into dev branch, and a little while later b is pushed as well. Now if they both happened to have modified the same thing, what happens here? Do I just have to choose one version of the modified file, basically breaking one feature or the other?
>>
>>58656384
>F#
scorn and laughter are the only reactions you deserve
>>
>>58656417
whoops

>>58656178
>>
I've got a problem, /dpt/, that I can't figure out.

I've got a database where I receive temperature and humidity values through a Servlet on an Apache Tomcat server.

I put the received values in a database and that all works well, but I also want to call another function, that will check if these values affect any of my logic rules, and this function is never called.

No errors, nothing, never called. And I can't for my life figure out why.

I'm posting some code below, so you can get more insight.

@POST
@Consumes(MediaType.APPLICATION_JSON)
public void postJson(String content, @Context HttpServletRequest req, @PathParam("id") String id){
Connection conn=null;
Statement stmt=null;

String sql="",function="",link_write="",nodeip="", state="",value="";
JSONParser parser = new JSONParser();

try{
JSONObject obj = (JSONObject)parser.parse(content);
if(id.contains("the")){
if(content.contains("lower_temp")){
String temp = (String)obj.get("temperature");
String humid = (String)obj.get("humidity");
String heat_ind = (String)obj.get("heat_index");
String lower_temp=(String)obj.get("lower_temperature");
String upper_temp=(String)obj.get("upper_temperature");
String mode=(String)obj.get("mode");
String interval=(String)obj.get("interval");
updateNodeData(id,temp,humid,heat_ind,lower_temp,upper_temp,interval,mode);
checkCondition(id, "1", temp, "temp");
checkCondition(id, "1", humid, "humid");

Logger.getLogger(StateResource.class.getName()).log(Level.SEVERE, "Send temperature and humidity to LogicEngine.");
}

Part of the servlet code
>>
>>58656180
just started reading it 5 minutes ago and I can already tell I'm gonna like it
>>
>>58656416
You have to resolve that conflict yourself, either by using one of the two merges, or rewriting that part so they both work.
>>
>>58656416
you have to resolve all conflicts manually if the same bit of code was changed in both branches.

You can do it interactively, git will dump both versions of the conflicted code into the file and you edit it to suit and then continue the merge.
>>
>>58656167
>untyped
>>
>>58656416
git has tools to automatically merge to files and on occasion you need to do it by hand.
>>
>>58656166
git clone gud ?
>>
>>58656444
attach a debugger
>>
>>58656444
Hit the limit. The checkCondition function is never called, it is in the same class.

public void checkCondition(String id, String state, String value, String type){
Statement stmt=null;
ResultSet result = null;
String sql = "select * from _condition where watcher_id='"+id+"' and type='"+type+"';";

try {
result = stmt.executeQuery(sql);

if(result!=null){
while(result.next()){
String operator = result.getString("operator");
Logger.getLogger(LogicListener.class.getName()).log(Level.SEVERE, "Checking operator"+operator);
switch (operator){
case "<":
if(Float.parseFloat(value)<=Float.parseFloat(result.getString("value"))){
Logger.getLogger(LogicListener.class.getName()).log(Level.SEVERE, "Smaller than comp");
updateConditionState(id,"1");
checkLogicUnit(result.getString("_logic_unit_id"));
}else{
updateConditionState(id,"0");
}
break;
case ">":
if(Float.parseFloat(value)>=Float.parseFloat(result.getString("value"))){
Logger.getLogger(LogicListener.class.getName()).log(Level.SEVERE, "Larger than comp");
updateConditionState(id,"1");
checkLogicUnit(result.getString("_logic_unit_id"));
}else{
updateConditionState(id,"0");
}
break;
default:
Logger.getLogger(LogicListener.class.getName()).log(Level.SEVERE, "Default case, no comparator.");
break;

};
}
}


Is there any limit as to what a servlet can do?
>>
Git? More like
...
...
...
Shit.
>>
>>58656454
How could anyone not?

>We are about to study the idea of a computational process. Computational
processes are abstract beings that inhabit computers. As they evolve, pro-
cesses manipulate other abstract things called data. The evolution of a pro-
cess is directed by a pattern of rules called a program. People create pro-
grams to direct processes. In effect, we conjure the spirits of the computer
with our spells.
>>
>>58656501
Name 23 things wrong with git
>>
>>58656484
How would I do that if my server is running on another machine?
>>
>>58656523
attach to host:debug_port
>>
>>58656534
Thanks anon! Hopefully I'll find the problem.
>>
File: 1480085554548.jpg (38KB, 500x644px) Image search: [Google]
1480085554548.jpg
38KB, 500x644px
I'm working on my decentralized TV system (BasicTV, Git is github.com/Dako300, IRC is #basictv on Freenode). I'm currently working on bootstrapping code to get the initial encryption keys for produced content on there. I'm also working on a console interface for controlling streams, uploading, and other stuff.
>>
File: 1461911897688.gif (2MB, 250x188px) Image search: [Google]
1461911897688.gif
2MB, 250x188px
/dpt/ I have some questions

So I learned in school how to program with Java SE, Java EE (Spring Boot), PHP and Javascript.
Thing is I'm in one of the most lame school of my city. I'm getting the diploma soon and feel like I'm really underskilled and while I won't even bother talking about my PHP and Javascript skills, I really want to lear more about Java EE and SE so I a few questions I'm in need of advices.

- I learned how to use Spring Boot (poorly) but some people told me here that it was a poor choice ? What would you advice to program on Java EE ? What's the best current option ?

- Any advices on the process of learning a language ? (Teachers makes us learn the synthax and wu mostly had to do some projects to the end of the course without really learning more than that)

If I think about more questions, I'll ask them but that's all I have for the moment.
>>
File: Untitled.png (439KB, 1280x720px) Image search: [Google]
Untitled.png
439KB, 1280x720px
So far my webm for retards rip-off is coming along nicely.
I still have to add lots of parameters, organize the UI and add some infotips.
>>
>>58656534
Found it!! My Connection and Statement for the Sql query were both null

I guess that means my thermostat will work! Thank you so much anon!!
>>
>>58656491

Where is your catch statement?

What are you using for your SQL driver? Are you using sqlite or something else? Looks like you might be using static variables? Are they shared with calling function?
>>
>>58655880
Reposting here so it's seeeeeen

I'm pretty sure it's a rounding error between SDL and OpenGL. SDL talks about screen space in integer pixel locations which OpenGL talks about the same space in the reals [-1,+1]. So when OpenGL goes to rasterize the pixel the edges of your font potentially fall on the edges of pixels, the n.4th pixel rather than the nth which causes OpenGL to blend the two adjacent pixels.
>>
Been learning haskell and reading up on some general category theory. I'm really liking it.
>>
I'm working on a bastardized Lisp implementation in C. I have a recycling memory model working and I'm now starting on modeling the environment.
>>
>>58656692
MySQL, the catch comes later, the code also controls switches and dimmers.

Anyway, my error came from copying functions and changing them. I didn't copy the initialization of Connection and Statement for my SQL Selects.

Fixed it and now it works.
>>
>>58656123
I wanna do some OpenGL in C++, how should I approach this, should I just minimally wrap the main drawing loop and do something like engine.run(), and if so how do I implement this?
Or do I just call the drawing function C style?
It seems to me like wrapping it would lead to problems with state seeing as I can't very well absorb all of the state into a RAII-style interface.
>>
>>58656859
>It seems to me like wrapping it would lead to problems with state seeing as I can't very well absorb all of the state into a RAII-style interface.
You can definitely wrap it in a bindless API.
>>
>>58656859
You should be able to wrap it well enough. You should make it so all of the state functions are in one call, but it is expandable and controllable through a better API
>>
>>58656859
>>58656872
https://blog.molecular-matters.com/2014/11/06/stateless-layered-multi-threaded-rendering-part-1/
This series will probably be of interest.
>>
File: 1423807154158.jpg (3MB, 2005x2921px) Image search: [Google]
1423807154158.jpg
3MB, 2005x2921px
>>58656416
If somebody has made changes before you and put you behind the branch you want to merge into, then you rebase onto the branch that is ahead of you and then proceed to make sure your changes are still relevant after the rebase.
Don't let employees just branch and merge over top of each other, this creates merge conflicts, which can be resolved but are best avoided.
>>
Local game developer near me is hiring. They're decently successful, but they're asking for expertise in C++ and Bachelors or relevant experience.

Whats considered expertise? i've made a handful of games, incredibly basic and not great, and I've done some C++ but nothing crazy but I want to see they're offering good money and game dev sounds like fun despite the long hours and repetitive nature.
>>
>>58656936
It means they want to hire an H1B from india.
Don't apply.
>>
>>58656936
What company?
>>
Why doesn't Intel just write "need not apply, whiteboi" in their career website?
>>
>>58656463
still better than hasklel
>>
>>58656988
Because it's racist.
By not being up front about it, you have a hard time trying to prove that they have racist hiring practices.
>>
>>58656936
if your games really are that basic then that's probably not good enough. it would help if you had a lot of in-depth knowledge of C++ and if you made more complex games where you implemented some clever algorithms and stuff
>>
Why is it in C++ that
myVar = (x > y) ? myVar++ : myVar--;

Doesn't work, but
myVar = (x > y) ? myVar + 1 : myVar - 1;

Does?
>>
Could someone explain how to use pointers in C to me in another way?

struct mutantfrog {
int num_legs;
int num_eyes;
};
void build_beejs_frog(struct mutantfrog *f)
{
f->num_legs = 10;
f->num_eyes = 1;
}


what is the purpose of the -> operator? He said it's like dereferencing and using the pointer as if it were the variable, right?

When is it better to use the -> operator vs the . operator?
>>
File: js.jpg (11KB, 600x159px) Image search: [Google]
js.jpg
11KB, 600x159px
>>58657010
>>
>>58656662
bump.

Or should I make it a thread ?
>>
>>58657178
i'm confused between the . operator, the & operator and the -> operator
>>
>>58657171
myVar++ increments myVar but has value before increment.
Do ++myVar.
>>
>>58657178
use -> with pointers. f->foo is the same as (*f).foo
>>
in java can I cast a float to int and pack it into a long. and later unpack it and cast it float without losing information? should be possible right?
>>
>>58657171
Ternary operators only allow expressions, not statements.

myVar++ is a statement with a side effect.
If it was allowed in a ternary statement, it would lead to undefined behavior.
Does the ++ apply before or after the assignment of myVar?
>>
>>58656123
Trying to get my fucking internet to stop shitting out

I know its PC side and not hardware, wired connections have stopped working and when it shits the bed network related wizards stop responding, ipconfig release/reset hangs, usb wifi dongles stop responding

I REALLY DONT WANT TO FUCKING FORMAT
>>
>>58657171
x = x++ is undefined behavior.
>>
File: javascript.png (5KB, 148x107px) Image search: [Google]
javascript.png
5KB, 148x107px
>>58657185
>>
>>58657218
use Float.floatToRawIntBits() (or Float.floatToIntBits()) and Float.intBitsToFloat()
>>
>>58656988
Did you know 0% of their employees are Indian? Check for FACTS! http://www.intel.com/content/www/us/en/diversity/diversity-in-technology-annual-report.html
>>
>>58657236
AAAND THERE IT FUCKING GOES AGAIN

NOT EVEN FIVE MINUTES AFTER REBOOT

NOW ANGRILY POSTING FROM FUCKING PHONE
>>
>>58657267
>We increased hiring of underrepresented minorities
>We increased our hiring of women
what's wrong with these people? since when do jews practice what they preach?
>>
>/g/ mad because they can't compete with pajeet
>>
>>58657378
they still have mostly white and asian males
>>
has anyone ever done any development for fitness trackers?

im working on a project now that uses fitness trackers and im just trying to decide which brand i should go with, since they all have unique apis. right now im pretty set on fitbit just from how popular they are, but they seem to start at 100 dollars so if anything is cheaper than that and has a relatively open api than i'd love to hear about it
>>
>>58657267
>they wasted 300m$ on pointless shit like that
wtf i hate intel now
>>
>>58657448
I don't think you realize just how rich intel is.
They can blow AMD's yearly operating budget on a progressive outreach program just because they can.
>>
why are pajeets so keen on sql and databases in general?

like everytime i search for anything database related its just full of tutorials and answers from thousands of pajeets, never any white people
>>
>>58657448
promoting racemixing and degeneracy so they can enslave the world isn't pointless to them
>>
>>58657478
db=munee
>>
>>58657478
Because that's all they know how to do.
It's also pretty important if you want to do anything non-trivial for the web or for enterprise applications.
>>
>>58657478
CRUD is boring, but easy
>>
File: amd.png (120KB, 977x673px) Image search: [Google]
amd.png
120KB, 977x673px
>>58657475
according to wolfram, intel has over 10x as many employees and makes over 20x more per year

obviously that isnt net profit though, since intel bamboozles a lot of their money away in marketing campaigns
>>
>>58657448

That's nothing compared to the 2 MILLION PAJEETS Google is training

http://economictimes.indiatimes.com/tech/internet/google-to-heavily-invest-in-india-train-two-million-developers-on-android-platform-sundar-pichai/articleshow/50200824.cms
>>
>>58657545
if you're not learning C, you will never compete with pajeet
>>
File: poop.png (43KB, 400x316px) Image search: [Google]
poop.png
43KB, 400x316px
Revisiting one of my old programs, and parallelized canvas application & distance checking.

This program tried to build an image from a list of randomly generated candidate shapes.
>>
File: mona.png (112KB, 396x600px) Image search: [Google]
mona.png
112KB, 396x600px
Here's the mona lisa with a broken triangle rasterizer. I can't figure out how to get my god damn triangles working right.
>>
>>58657714
how much trigonometry do you know
>>
>>58657714
do one with stallman
>>
why does a high level language like java not just allow inlined (not sure if thats correct term for it) c or assembly code? now you could say jni, but that's slow as fuck and actually reaching even sepples speed you need some ugly hack.
I know they want to keep it "safe" but if a coder fucks up its not the mistake of the language.
>>
>>58657728
it is not cross platform
>>
>>58657707
>>58657714

That's pretty cool. Mind sharing the source? What's it written in, anyway?
>>
File: 1360087312562.gif (994KB, 500x220px) Image search: [Google]
1360087312562.gif
994KB, 500x220px
Question for you guys: If I want to immigrate to Australia from the US, which language/ language combo would have the highest odds of landing me a sponsored job?

I was thinking Python/JavaScript, or possibly Python/Java.

Thanks nerds.
>>
File: 1485227775449.jpg (62KB, 600x596px) Image search: [Google]
1485227775449.jpg
62KB, 600x596px
gibs me dat get, this is affirmative action
>>
>>58657728
why would it, use C/C++ retard
>>
>>58657721

Enough to be dangerous, but not enough to write a working triangle rasterizer. Fwiw, I've tried the method that splits top/bottom flat triangles and that didn't seem to work, and I've tried variations of it as well, which didn't seem to work either.

I know (for sure) that the barycentric method would work, but it'd be much slower.

>>58657724

I'm going to do one with the oats pigs in a little bit, and then I can do one of stallmanu.

>>58657748

I'll get around to sharing the source eventually. It's written in C#. It does use a substantial amount of memory, though, since the candidate shapes are applied to copies of the canvas and error checked, in parallel.

That selection process was the bottleneck of the original version, but it didn't have to store numCands copies of the current best image.

So, essentially, it was a tradeoff between time and memory use.
>>
>>58657776
no
>>
File: ptg00763124.jpg (40KB, 396x264px) Image search: [Google]
ptg00763124.jpg
40KB, 396x264px
employed Haskell programmer reporting in
>>
File: dependent types.png (7KB, 224x225px) Image search: [Google]
dependent types.png
7KB, 224x225px
>>58657859
>>
>>58657844
then deal w/ it faggot. jni isn't even slow it's like 20 cycles for a call
>>
File: IMG_7526.jpg (61KB, 399x582px) Image search: [Google]
IMG_7526.jpg
61KB, 399x582px
Anybody got a degree in computer science?
I just finish my first class last semester and already I'm dreading the future
>>
File: javascript.png (32KB, 576x402px) Image search: [Google]
javascript.png
32KB, 576x402px
>>58657010
>javascript
>>
>>58657887
Yes, it's depressing
Learn a trade instead, like carpentry
>>
>>58657905
No I want to be a data scientist I can't quit now
>>
>>58657887
I'm finishing one.
What exactly are you dreading? CS classes don't get hard or even interesting until 300/400 level. Most interesting class I took was one filled with masters level students and we built an AI that used a neural net to build its own decision trees, which kept it low resource and fast
>>
>>58657887
finishing my last semester. it gets easier with time. stick with it, go to class, and do your fucking homework. not gonna tell you it will be easy but it will definitely be rewarding.
>>
>>58657887
>already I'm dreading the future
Why?
>>
>>58657310
InstallGentoo®
>>
File: IMG_7512.jpg (134KB, 900x900px) Image search: [Google]
IMG_7512.jpg
134KB, 900x900px
>>58657923
So far just beginning to make consoles stuff with c++
What I'm dreading most is just the fact that the most worthwhile thing I've done in there was make a console program ask the user a question and has the user input a menu command.

>>58657924
I'll drink to that

>>58657933
All I know is how to barely use c++
>>
>>58657964
Yeah that sounds about right for a first class.
You'll probably learn how to build some data structures this semester, linked nodes and all that. Then after that you'll probably build your own shell for linux, or if you've got a good university your own basic OS entirely.
>>
File: 1426548231392.png (141KB, 800x600px) Image search: [Google]
1426548231392.png
141KB, 800x600px
>>58657964
just make sure you self-study and not just expect to get spoonfed
>>
>>58657267
I think I've seen only one white Intel employee, the rest have been Indians.
>>
>>58656123
Shitting my brains out in preparation for a J2EE interview
>>
>>58658137

Woah. I have one of those tomorrow too. I'm on 4chan also.

> feels bad man
>>
>>58658021
Java's a tumor on the mind.
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Command_Line;

procedure Main is

Counter : Natural := Natural'Value(Ada.Command_Line.Argument(1));
Line : String(1..Counter) := (others=>' ');

begin
for I in 1 .. Counter loop
Line(I) := '*';
Line(Counter-I+1) := '*';
Put_Line(Line);
Line(I) := ' ';
Line(Counter-I+1) := ' ';
end loop;

end Main;
>>
>>58658021
for(int i = 0; i < 9; i++){
for(int j = 0; j < 9; j++){
System.out.print((j == i || j == 8-i ? "*" : " "));
}
System.out.println();
}


should work
>>
File: 1485400515381.png (499KB, 800x415px) Image search: [Google]
1485400515381.png
499KB, 800x415px
>>58658092
check your privilege
>>
>>58656123
Monte Carlo fitting algorithms and stuff
+studying for my Pascal final next week
>>
>>58658021
#include <stdio.h>

int main(int argc, char **argv) {
int i;
int size = argv[1];
char arr[size] = { [0 ... (size-1)] = ' ' };
for (i = 0; i < size; i++) {
arr[i] = arr[size-1-i] = '*';
printf("%s", arr);
arr[i] = arr[size-1-i] = ' ';
}
return 0;
}


And I don't even know C that well
>>
I want to work on a project, ideally a game. In the previous thread someone mentioned a text adventure and I like that as a starting point.

I also want to learn C and think such a project would a great way to learn the language. Do you agree, or should I go with C++?

In the previous thread someone also mentioned storing a game's map in a text file as a database to read in at run-time.

I have no idea how to do that and I'm not familiar enough with the language of the idea to research it on my own.

Can anyone lend a tip or a starting point?
>>
Is there a complete guide to any language that I can get that shows a video of how to do it in a step by step. Gonna be working as a truck driver and will have access to about 2 hours of free time but limited monthly internet(like 7 gigs) and reading a book while the truck is moving is kind of a pain.
>>
>>58658271
I can tell
>>
File: 1479425846260.jpg (27KB, 450x375px) Image search: [Google]
1479425846260.jpg
27KB, 450x375px
>>58658343
pls tell how improve
me want good
>>
#lang racket
(define size 9)
(for ([i (in-range size)])
(for ([j (in-range size)])
(display
(if (or (= i j)
(= i (- size j 1)))
#\*
#\space)))
(newline))
>>
>>58658191
vlad?
>>
>>58658360
start by actually trying to compile it
>>
File: ss.png (406KB, 1280x1024px) Image search: [Google]
ss.png
406KB, 1280x1024px
Been teaching myself Python for a couple weeks.

You think it's worth my time to devote some serious effort in HarvardX's CompSci 50 course?

I don't want to be a real programmer, I just want to be able to hack some shit together quickly to get some stuff done.
>>
>>58658298
>that shows a video of how to do it
Do what, nigger?
>>
>>58658298
please don't do that. listen to books and get cultured.
>>
>>58658377
Welp I have no idea how to properly initialize arrays
So much for that
>>
File: 979829894998195934.jpg (32KB, 339x532px) Image search: [Google]
979829894998195934.jpg
32KB, 339x532px
>>58658413
>>
>>58658298
>reading a book while the truck is moving is kind of a pain
So is watching a video. Eyes on the road, tiger.
>>
File: 1482354038658.jpg (50KB, 500x548px) Image search: [Google]
1482354038658.jpg
50KB, 500x548px
>>58658423
>>
>>58658298
Keep your eyes on the road and listen to an audio book or something.
>>
>>58658437
christ-chan is cute
cute!
>>
File: 1482353607938.gif (259KB, 350x622px) Image search: [Google]
1482353607938.gif
259KB, 350x622px
>>58658482
>>
>>58658397
>>58658402
>>58658433
>>58658452
Guess you guys misunderstood. I drive team so about 12 hours I am in the back not driving. I have a full bench with a laptop.
>>
>>58658498
Then try Udacity, they have neat little video courses and you can watch videos for free even for paid ones if I'm not mistaken, you just can't get their """nanodegree""". I wouldn't know about which entry level ones are good, though, but have a little look around.
>>
>>58658226
>>58658372
> two for loops

>>58658271
> not C

quality stuff guys
>>
>>58656672
Which language ?
>>
>>58658298
learning programming that way sounds horribly inefficient

video tutorials are shit as it is, and if you're just watching without writing code at the same time it'll be even worse
>>
>>58658498
For fuck sake just watch some youtube videos and the rest you can google it. You can learn any language by doing that.
>>
>>58658562
I would like my hand held buddy. Also limited internet.
>>
>>58658653
>I would like my hand held
you're not gonna make it
>>
>>58658653
>Also limited internet
Can't you download the youtube videos at you home for watching them later?

Also this > >>58658672
Programming requires you to figure things out by yourself for the most part. If you wanna to have it easy, don't even waste your time.
>>
File: american_gothic_circles.png (63KB, 250x298px) Image search: [Google]
american_gothic_circles.png
63KB, 250x298px
Circles produce an interesting result.
>>
File: slither.jpg (18KB, 406x308px) Image search: [Google]
slither.jpg
18KB, 406x308px
Send me Injustice code
>>
>>58656454
>>58656504
Is it going to slow down on the basic math as it progresses? i'm kind of shit at it but i don't have the time to read two books right now.
>>
File: 000.png (232KB, 1533x808px) Image search: [Google]
000.png
232KB, 1533x808px
where did my layout view go?
can see the tab for text/design.

also, the start new project inteface is all jacked up, no option to choose target/min android version.

wtf, please help.
>>
File: aoi.jpg (55KB, 1280x720px) Image search: [Google]
aoi.jpg
55KB, 1280x720px
>>58658909
What's the most anime language?
>>
syscall(14085, "What's a Russian gunship doing here?");
>>
>>58658921
http://next.rikunabi.com/tech/docs/ct_s03600.jsp?p=002477
http://next.rikunabi.com/tech/docs/ct_s03600.jsp?p=002412
>>
>>58658921
I've been learning scheme lately and it's pretty anime-like.
>>
>>58658949
you mean because it completely lacks any depth?
:^)
>>
>>58658956
that wouldn't make it anime though?
>>
File: 1482425804508.jpg (92KB, 358x429px) Image search: [Google]
1482425804508.jpg
92KB, 358x429px
>>58658966
scheme is shit!
>>
File: part1_img.jpg (54KB, 300x440px) Image search: [Google]
part1_img.jpg
54KB, 300x440px
>>58658941
This is the kind of thing I need in my life
>>
>>58658981
but i didn't say anything about it being shit or not
also
>anime is shit
>>>/r/ibbit
>>
>>58658376
What did he mean by this?
>>
>>58656738
Well first off, you shouldn't be mixing SDL Rendering and OpenGL rendering calls.
>>
File: 1484968758645.jpg (57KB, 300x300px) Image search: [Google]
1484968758645.jpg
57KB, 300x300px
>>58658995
anime isn't shit
that's why scheme isn't anime
>>
>>58658380
one simester university-like course is just the best way to do that
>>
File: java.jpg (67KB, 300x440px) Image search: [Google]
java.jpg
67KB, 300x440px
>>58658990
ftfy
>>
File: part2_img.jpg (88KB, 300x440px) Image search: [Google]
part2_img.jpg
88KB, 300x440px
>>58659059
Brown girls are cute too
>>
File: 1460239831414.jpg (62KB, 300x300px) Image search: [Google]
1460239831414.jpg
62KB, 300x300px
>>58659005
why is it shit? and compared to what? other lisps? i haven't tried them yet but I probably will in the future.
anime is white and based though.
>>
>>58659051
>university-like course

Does that include those online courses like udemy?

I've used them for other things and the structured nature of the courses was worth the $10 or w/e
>>
>someone calls themselves a "programmer"
>doesn't know C
>>
>>58659107
because it's lisp
>>
>>58656123

Need some links to cram for Java interview.
>>
>>58659162
https://www.youtube.com/watch?v=Qe026vn1tbc
>>
>>58657185
What the fuck? Why.
>>
How much monitor space do you guys need? I was thinking of getting a little baby laptop like an x220
>>
>>58659193
Nevermind, got it.
>>
>>58659172

Pretty good, but too rudimentary. I need algos! I need data structures! I need collection interfaces! I need optimization for parallelization!
>>
>>58659116
Absolutely yes. Peeking at the HarvardX cs50 syllabus going through week 5 will have you literate in code, as in using the material up to that point you can in theory read any algorithm. If it's your goal to just hack stuff together the machine learning and database stuff will be super important to you too.
>>
File: spj.jpg (31KB, 224x223px) Image search: [Google]
spj.jpg
31KB, 224x223px
stop doing IO
>>
File: photo.jpg (132KB, 900x900px) Image search: [Google]
photo.jpg
132KB, 900x900px
Stop using a network
>>
why aren't you using type classes in c#?
concept Num<A> : Eq<A> {
A Add(A a, A b);
A Mult(A a, A b);
A Neg(A a);
}
instance NumInt : Num<int> {
bool Equal(int a, int b) => EqInt.Equal(a, b);
// named instance EqInt useful here (c.f. Haskell)
int Add(int a, int b) => a + b;
int Mult(int a, int b) => a * b;
int Neg(int a) => -a;
}


https://github.com/MattWindsor91/roslyn/blob/master/concepts/docs/csconcepts.md
>>
File: Nicklandroid.gif (2MB, 440x440px) Image search: [Google]
Nicklandroid.gif
2MB, 440x440px
Stop using non-biological computational substrates
>>
File: perf1.png (21KB, 715x249px) Image search: [Google]
perf1.png
21KB, 715x249px
>>58659349
performance is one point with hardcoded one, better than OO shit AND more generic
>>
>>58659349
>why aren't you using type classes in c#?
because i'm not using c#
>>
>>58659349
>not having concept semigroup, monoid, rig, group, ring
>>
>>58658553
C# + WPF
I'm learning C++ right now and I'm thinking of porting it to Linux and use it as an exercise to making GUIs (x11) on Linux. I'm probably gonna use Qt for that , but I don't know how flexible the creation of controls on Qt is.
>>
>>58659349
also in F#

work done by based Claudio Russo of Microsoft Research Cambridge and some guy named MattWindsor91, they forked the compiler which you can find here https://github.com/MattWindsor91/roslyn
>>
>>58659388
https://github.com/dotnet/roslyn/issues/16312

issue to merge it into c#
>>
>>58659240
Explain please.
>>
>>58659349

I just don't get what C# is supposed to be anymore.

It's this weird amalgam of OO, FP, and Linq. I think it is having an identity crisis.
>>
>>58659455
Nothing in that code is OO, it just gives you choices
>>
>>58659385

I hate WPF. Post traumatic syndrome.
>>
>>58659455
>It's this weird amalgam of OO, FP, and Linq
better than being straight up OO trash
>>58659460
>Nothing in that code is OO
he didn't imply that though.
>>
any book you guys recommend for software design practices?
>>
>>58659460

Yeah, I guess so.

I am a little traumatized by my last job (boss overused FP in very buggy, convoluted ways), but I have seen beautiful C# too.

I will just try to purge my memories from the atrocities that I had witnessed.
>>
>>58659465

True.

I suppose I have seen good C# FP and Linq too.

It's just I went from a nice node.js shop where the principle architect came from a scala background to a buggy C# shop where the 3 styles of programming (FP/OO/Linq) were mixed together in very convoluted/buggy ways, so I still have some bad memories and bias.
>>
>>58658550
I dont see your solution. so maybe shut the fuck up.
>>
File: 979848871856090531.png (1MB, 1180x1080px) Image search: [Google]
979848871856090531.png
1MB, 1180x1080px
>>58659462
Well, at least for me it's ok I guess.
The only thing that I still didn't get used to is XAML and its data binding, I still have a bad habit of doing everything the old way by code if possible, I only use XAML for the basic control structuring.
>>
>>58659564
[spoiler] yes you have [/spoiler]
>>
>>58659580

Yeah, ideally, everything could be done in binding. But, pragmatically, if you are doing stuff in code behind, then it's probably more bearable.

The cool thing about learning XAML is that then you can work on Xamarin mobile apps more easily.
>>
>>58659455
C# is pretty shit imo like it only makes sense if you're using it with microsoft stuff like windows applications and windows server and things like that
>>
can I somehow find out the address to the memory of (an on-heap) bytebuffer if its not direct? if its direct I can read the address fiel with reflection and its done.
>>
>>58659874
in java obviously
>>
is it possible to translate any for-loop to a recursive style?
>>
File: 9ad.jpg (149KB, 527x516px) Image search: [Google]
9ad.jpg
149KB, 527x516px
best way to learn C++, im working on using this website
https://www.tutorialspoint.com/cplusplus/
any tips :(
>>
>>58659886
yes
>>
>>58659874

Dear God. I already was expecting to fail my Java interview, but I now am worried that I am going to look like a clown.
>>
>>58659893
Not learning C++ is the best option.
It's a terrible, terrible language.
>>
>>58659893
That is a good website. I recommend making something. Atleast, that is how I learn the best.
>>
>>58659947
no worries, friendo. the unsafe class is not official api and you dont need to know shit about it

http://mishadoff.com/blog/java-magic-part-4-sun-dot-misc-dot-unsafe/
>>
>>58659955

That is not true. It is better than C and still probably the best performance you can get without writing in assembly.
>>
>>58659947
Why do you want the memory adress, it's pretty much useless in Java.
>>
>>58659967
>It is better than C
No it's not.
>the best performance you can get without writing in assembly
C is better than C++ in most situations.
C++ doesn't even have restrict pointers.

Seriously though: do you only know C++?
If you knew any other language that is actually designed well, you would see how much of a shitshow C++ is.
>>
If your base class has a constructor is it okay to leave one out for your derived class?
>>
>>58659997
if you never want anyone to instantiate it
>>
>>58659988
Not them but if this is true why is everyone lying to me about C++
>>
>>58660003
I mean it works I just don't know if I'm relying on undefined behavior.
>>
>>58657901
Wat
>>
>>58659417

parseInt has an optional second arg that gets filled by map that fucks everything up

but nobody ever uses map without a lambda anyways, so its a nonissue. much like >>58657901

ive written like 50k lines in javascript over the past year and havent ran into any of the meme issues. only issues I ever have stem from it being dynamic
>>
File: Trmpff.jpg (72KB, 1200x630px) Image search: [Google]
Trmpff.jpg
72KB, 1200x630px
Coder babby here.

I used to work through ZELLE's Python book. It was great. Taught me Python.

Most rewarding thing I've done in a long time. I need something new, a great textbook -- something similar to Zelle's work.

What's /g/'s recommendation for GREAT and ORDERED CODING BOOKS?
>>
Uhm. What is a good textbook to read when you are always on the move?
Something like an introduction to Computer science or shit.
>>
>>58660110
https://www.amazon.co.uk/American-Railway-Journeys-Michael-Portillo/dp/1471151514
>>
>>58660093
>parseInt has an optional second arg that gets filled by map that fucks everything up
>but that doesn't matter
Of course it matters. It's an extremely confusing error to have.
>>
>>58660011

He is just being religious.

C is a hacky language. The syntax is questionable, and you can do questionable things with that garbagy syntax.

Obviously, this is perfect for hacking and very low level coding.

The marginal performance gain is not worth it compared to the much better syntax you will encounter in C++.
>>
>>58660138

youre never going to run into the error in the real world

programmer theorycrafters are the worst
>>
>>58660164
>youre never going to run into the error in the real world

nobody is ever going to turn a list of strings into a list of ints?
>>
>>58660011
>why is everyone lying to me about C++
Because it creates jobs and that's good for the economy. For people who just care about themselves and their own software it's not good at all.
>>58660143
This is all just lies.
C++ usually adds confusing errors and unnecessary constructs.

I suppose if you're a moron that doesn't compile with warnings as errors C can be worse because some of the template-y stuff deprecates some of the warnings and C++ has more strict implicit conversions.
But if you ask your compiler to treat you nicely with C it will.
>>
>>58660173
>>58660143
So C++ isn't good unless you want work
>>
>>58660164
>nobody is gonna ever want to use a map call to parse strings to integers
Care to explain how the code written doesn't look completely sane without knowing this small detail?

Not to mention it's a silent error.
>>
>>58660173
> not studying C++
> hurr durr C++ is confusing
>>
>>58660188
C++ is a god-tier language
if you need performance and don't want to kill yourself writing your own data structurs in C, there's no way around it
>>
>>58660171
>>58660190

attention morons do not pass random functions into map directly nobody does this use lambdas

nobody can save you from being retarded. i have no idea how this is too much to ask
>>
File: 1483369485134.gif (995KB, 280x201px) Image search: [Google]
1483369485134.gif
995KB, 280x201px
>>58660214
>C++ is a god-tier language
>>
>>58660226
Nice anime
>>
i have catalogued this post for future analysis
>>
>>58660200
I did back with C++11. Thought the language was finally mature. Clearly wasn't the case.
>>58660188
Sortof. There's less C jobs overall but it's not like people don't hire C devs.

Something people often seem to forget when looking at job statistics is that you can only have one job or at most two maybe. It doesn't really matter if there's a ton of C++/Java/C# devs if you have enough places to work at.

Also the popular languages arguably face more competition. Though it's also the case that they have the most amount of shitters (because shitters go to the most popular)
>>58660214
>and don't want to kill yourself writing your own data structurs in C
How is this even a problem?! If you absolutely want to avoid your own data structures because you're a complete fuckup then use a library. Treating the standard library like it's some kind of god is for retards.

At least go to D if you wanna do high level & performance oriented programming.
>>
File: 502175.jpg (200KB, 704x480px) Image search: [Google]
502175.jpg
200KB, 704x480px
>mfw this C shill samefagging this hard so people can like his old deprecated language
>>
>>58660136
Uh... maybe something computer science related instead?
>>
>>58660256
>samefagging
So basically you're saying I'm sitting here making fraudulent posts supporting C++ poorly and I argue well for C?
Thanks?
>>
>>58660253
>performance oriented programming
not this again

please stop with meme oriented programming and bandwagon driven design
>>
>>58660250

you should try actually programming
>>
>>58660253
desu im just trying to get a feel for what's out there but i guess it's hard unless you already have programming experience

Guess I'll just start with whatever and if it's ass I can learn something else

I don't have an end goal exactly but it'd be nice to get some supplemental income from freelance work at the least eventually.
>>
>>58660110
Computers and Intractability.
>>
>>58660101
up
>>
>>58660285
>Guess I'll just start with whatever and if it's ass I can learn something else
Yes. If you don't have any goals this is a good way to go because you're not attached to a language for arbitrary reasons. Like some anon who told you that a language is the best to learn or whatever.

Just avoid some of the esoteric languages.
>>
>>58660279
Says the Javascript dev
>>
>>58660253
>D
nice meme bro now kys irl
>>
>>58660263
What it's just a term to contrast with people who write code without performance concerns and if it turns out they don't need it they don't need it or if they do they just try and fix it a week before shipping.
Performance oriented programming just means you have it in the back of your head quite frequently.
What's wrong with that?
>>
>>58660101
Learn you a Haskell is great if you're a coder baby.
>>
>>58660223
you do in real languages
>>
>>58660223
>you can't just ask for the compiler to correct your errors. You need to babysit it every step of the way!
>are you stupid or something?!
I don't even see why parseint isn't implemented in a way that allows it to be passed to map. Seems very odd for a standard library.
>>
What's the best C++ debugger for Linux?
I'm using DDD atm but it feels a bit clunky. Maybe I'm not just using it right?
>>
>>58659874
wtf are you doing you stupid nigger

it doesn't have a fixed address, it can get moved around by the GC
>>
>>58660011
it's just his hot opinions

C++ has __restrict__ extension on all relevant compilers anyway
>>
>>58660345
[autistic screeching]

I need it for exactly for one copy memory call
>>
>tfw you weren't lectured like this in school
https://macton.smugmug.com/Other/2008-06-18-by-Eye-Fi/n-3Q2Vv/i-DVDVwSV
Why is school so shit? This was so incredibly concise.
>>
>>58660393
The system in most places is set up so that teachers are incentivized to be lazy and unqualified
>>
>>58660393
>tfw you weren't lectured like this in school
That's because I'm not a retard like you.
>>
>>58660367
use a direct buffer then? are you using JNI or why else do you need the address? there's also GetPrimitiveArrayCritical in JNI

http://stackoverflow.com/questions/3651737/why-the-odd-performance-curve-differential-between-bytebuffer-allocate-and-byt/11004231#11004231
>>
>>58660307

im proficient at most major langs besides java lul

>>58660317

enlightening

>>58660329
>compiler

parseInt is very old. map is somewhat new. the convenience of accessing indexes inside map callback outweighs the clash with parseint. this is typical for languages that remain popular (creates demand for new features) over a long period of time (more opportunity for fuckups to happen)
>>
>>58660285

I have worked professionally in Java, C#, VB, JavaScript (node.js, several front end frameworks), Python, R, Objective-C, and C/C++. I think that is all. I have used some other languages too but not professionally.

C is a hacky language and you can do things that you should not be able to do (like accessing negative indices of arrays). I do not see very many C or C++ jobs advertised in the US. You have to look for them if you want to find them. These are older languages that are used mostly to teach cs students, high performance computing (modern languages run the old C/C++ code under the hood), to create OS's, and that is about it.

If you want to really have a deep understanding of programming and computers, learn C first.

If you want to just make money and make something cool, learn something else.
>>
>>58660426
>parseInt is very old. map is somewhat new.
This kind of issue is understandable if this were some kind of hobby language.
It's not though.
>>
>>58660437
>javascript
it is though :^)
>>
File: hqdefault.jpg (16KB, 480x360px) Image search: [Google]
hqdefault.jpg
16KB, 480x360px
>>58660433
thanks i was the one who asked for guidance about c++ in the first place. i guess that C is mostly for enthusiasts, is it also the grandadaddy of languages?
Im guessing C++ is more of a project language no?
>>
>>58660417
I wrote my own unsafe bytebuffer because autism and I need it for specific use case.
and the reason I need address is so I can memcopy the on-heap buffer into the off heap buffer and so I dont have to convert the buffer into a byte array first.
in other words: there might be a on heap bytebuffer down the line and in that case it would give some extra speed.
>>
Can someone who writes code in ABAP even be considered a programmer?
>>
>>58660437
i dont understand your point.

upon introduction of map there were 3 design possibilties:

change parseint signature (causing every browser over the next several years to break all preexisting websites as they catch up to the new standard)

change map (you now have to manage the index by some other means which is hugely inconvient in 99999x more usecases than the one youre trying to avoid)

the current situation

current situation is pretty clearly the best option they had


if youre saying map being new is inexcusable, 2011 makes it one of the earlier imperative languages to adopt map/filter/reduce/etc
>>
>>58660496
>current situation is pretty clearly the best option they had
nope

and they could've done

map

imap

and not tried to shoehorn there stupid fucking dynamic bullshit into everything, "oh it's flexible, oh it's flexing, oh it's broken"
>>
>>58660496
>I don't get your point
Part of language design is planning for the future.
A hobby language can have the naive "I'm just gonna make this thing" approach to development. There's a reason most major languages don't suddenly change/add things that may seem obvious wins.

I'm not involved enough with the details of JS to tell what the right choice is but they should be. The current situation isn't sensible.
>>
>>58660433
>I have worked professionally in
>lists large list of languages that'd require him to be at least 60 years old if it were the case that he has any significant understanding of all the languages and their tradeoffs
You haven't "used X professionally" because you had to change a piece of code once.

Most likely you're using these languages under assumptions that they're similar and your assumptions hold true.
>>
how are haskell binaries only 1mb but common lisp binaries like 60mb?
>>
>>58660534
>binaries
Because you're comparing apples and oranges.
>>
>>58660469

Yeah, C is probably pragmatically as close as you can get to writing binary in human readable form. That is why it teaches you alot about how the computer works, and that is why it creates very performant programs.

C++, as the name implies, is supposed to be the 2nd, better version of C. The language is Object Oriented which helped programmers start working collaboratively in teams.

Just jump into something and have fun with it. Alot of the things you will learn in any language will show up in almost all languages (data structures, control logic, etc).
>>
>>58659455
Everytime people have wanted something, the C# guys have thrown it in.
So you have delegates, and lambdas. Even though a lambda would make a delegate superfluous.

It's the C++ way. It's why C++ people like it more than Java, which tries to be conservative in adding features.
>>
>>58660599
imo you should just stick to using C++ and/or java unless you have a very compelling reason to use C# besides retarded personal preferences
>>
>>58660530

I hate that stupid meme. Old people come in all types. Being old does not mean you automatically are the gold standard. Being old just means you are old.

If you wasted 60 years of your life using Cobol and nothing else, that is your perogative, but to claim that everyone has to be you is just stupid.
>>
>>58660517

i guess its a matter of taste but this doesnt seem like a good solution

whats the equiv of
 ["apple", "banana", "orange"].map((f,i) => `${i}: ${f}`) 
?

id rather have a dyn language be as scrappy and convenient as possible. other languages serve other purposes

>>58660523

its easy to say "just design it better" in retrospect. c++, java, and php are the only other languages that really shared similar market pressures that javascript did and they all coincidentally happen to be languages people bitch about.

cant predict the future
>>
>>58660599

Really good point and cool perspective. I hadn't really thought about the language comparison like that before. Neat.
>>
>>58660627
>Being old does not mean you automatically are the gold standard.
I didn't mean it that way. I meant that he would have to be old to learn that stuff because it takes time.
>>
>>58660627
you listed a whole bunch of languages and you were talking about having a deep understanding of programming. saying you worked professionally with them implies you focused on each of them for at least a couple of years at a time, unless you're a web dev, which you seem to be since you think C/C++ are mostly just used for teaching and for creating operating systems.
>>
>>58660567
No, he's comparing binaries.
>>
>>58660011
Or, maybe, just maybe, the retards on /g/ don't know shit and they are the ones lying.
>>
>>58660637
it would be

["apple", "banana", "orange"].imap((f,i) => `${i}: ${f}`)

one extra letter to give you a different function, imap, with different behaviour
by trying to put everything together, you end up creating millions of edge cases in which the function is un-usable
>>
Why the fuck I'm learning assembly?
>>
>>58660645

I am the same anon. No, I just grew up poor so had to take as many jobs as I could.

Each language I listed actually represents atleast one separate employer, project, and promotion offer.

But it sucks, because most programmers get the same impression you got when they see my skills. "Jack of all trades master of none".

I enjoy learning lots of languages, but it's not like I wanted a fractured skillset. Just poor man.

Anyway, though, alot of the languages converge in many ways, so it is not as bad as it looks.
>>
>>58660660

And high performance computing. I do not know why you did not list that even though I had.

I do have professional experience.

You just passive aggressively implying things now? Whatever dude. I think you are the only one pushing C so hard.

I like programming. I don't have anything against C. I would be happy programming in it.

But, objectively, it has crappy syntax and is hacky, hence, C++ was created.
>>
>>58660675

current version of map supports callback with currentval, index, and the array were mapping over

so with this api design youd actually need map, amap, imap, and aimap? or you could settle for just map and aimap (but then one could use the same api flexibility argument you used in the first place to break this into individual functions)

there are probably other instances where huge api pollution would take place were it to replace optional args in this way
>>
>>58660689
Is it MIPS for class?
>>
>>58660689

Reverse engineering?
>>
Where do you all get your motivation to code? I'm currently taking up CS and there are times that I feel like this degree isn't for me since I'm not a good programmer compared to them. I don't have a problem with the math, just programming in general.

It's like I feel I wouldn't end up good in the industry since I'm not as good as my peers who can program well.
>>
>>58660821
I only took up CS since I was pretty interested in Computer hardware and now I'm in my 2nd year finding out we'd probably barely deal with hardware.
>>
>>58660821

You should program for fun.
>>
>>58660821
You should give a big fuck all to other people and focus on yourself.

If you don't like programming, then that's another problem.
>>
>>58660836
You make it sound like this is a surprise to you. If so, why?
>>
File: 18855.jpg (332KB, 1008x716px) Image search: [Google]
18855.jpg
332KB, 1008x716px
>>58660821
>Where do you all get your motivation to code?
Fuck if I know. I'm actually a pretty uncreative person when it comes to anything except coding.
I don't know why but I always have something fun (at least for me) I want to write. My life is pretty shitty right now, so coding is the only thing that keeps me entertained.
>>
>>58660903
I don't dislike programming, it just irritates me when I'm not able to do certain programs. Programming itself is fun I have to say but when it comes to requirements, it's hard for me to comply.

>>58660915
Well I've been wanting to handle computer hardware but apparently my uni doesn't offer Computer Engineering sadly. So I just took CS instead.
>>
>>58660951
That's because there is no programmer in the world who can program everything.

Take something, focus on that, and become good at that. You can't do everything.
>>
>>58660951
git gud
>>
why is software made for developers so user unfriendly? do they just expect you to figure everything out on your own?
>>
>>58661176
You sound upset about something in specific, tells us already, which IDE is pissing you off?
>>
>>58661202

QtCreator
>>
>>58660946
But hey it keeps you going at least. Some people would kill to have something they really want to do considering a lot of people don't know what to do these days.

>>58661032
Thanks though. I'm already considering C and C++ even though Java is our main language that we use.
>>
File: 1465359009571.jpg (33KB, 400x400px) Image search: [Google]
1465359009571.jpg
33KB, 400x400px
>>58656123
Can somebody explain this shit to me?

void setBitAt( char* buf, int bufByteSize, int bitPosition, bool value )
{
if(bitPosition < sizeof(char)*8*bufByteSize)
{
int byteOffset= bitPosition/8;
int bitOffset = bitPosition - byteOffset*8;

if(value == true)
{
buf[byteOffset] |= (1 << bitOffset);
}
else
{
buf[byteOffset] &= ~(1 << bitOffset);;
}
}
}


I can't understand this bit magic shit no matter how fucking long I stare at it, it's frustrating as all hell.
>>
>>58661240
look into bit shifts and bit operators
>>
>>58661240
disgusting code

but it should be pretty obvious if you know what the operators mean and boolean algebra
>>
>>58661240
buf[byteOffset] |=  (1 << bitOffset)

Sets one bit at given offset, as there is bitwise OR.
buf[byteOffset] &= ~(1 << bitOffset);

Clears one bin at given offset, since it applies bitwise AND to buf[byteOffset] and some 111..011..11 number, and the zero is the one we offset and later we perform bitwise NOT.
>>
>>58661240
>pwease pwese spoonfeedme, am too lazy to read what the operators do
>>
>>58656167
>not lisp or Haskell
>not even F# which sucks
this is bait
>>
File: 1479356942570.png (165KB, 389x384px) Image search: [Google]
1479356942570.png
165KB, 389x384px
>>58661358
>pwease pwese spoonfeedme,
>>
File: 280056.jpg (22KB, 482x377px) Image search: [Google]
280056.jpg
22KB, 482x377px
>>58661380
Fuck off, nigger
>>
File: 1474279625075.png (228KB, 466x552px) Image search: [Google]
1474279625075.png
228KB, 466x552px
>>58661394
I'm not them I just like being babied by cute boys
>>
>>58661176
>unfriendly? do they just expect you to figure everything out on your own?

XCode's Storyboard sucks. I agree.
>>
How many non-americans browse /dpt/?
>>
>>58661484
Sieg Heil \o
>>
Working on a game engine using OpenGL, glfw3, sdl2, ncurses, OpenAL, chibi-scheme, and a few other nice libraries, OpenCV/CCV (not decided yet).

It also stores NPCs in a pool with a score system which allows genetic algorithms to be used to improve the AI configurations.
Sound is split into audio files and generated where the current generator is built on top of a bytebeat machine (plan to switch from interpreter to compiler for bytebeat).
Scheme is used as a quick testing language for new features which are implemented in C after for better performance (results in scheme bindings for everything as an alternative to C).
IRC is used as a backend to chat as it "just works" and makes it easier as we can reuse a large portion of code.
Optional facial expression recognition which could be linked to a character's animation to reflect the mood of the player.
Natural language processing over menu systems as pressing 48 buttons / bethesda style select what to say breaks immersion.
Speech recognition/processing linked to the above.

Currently the glfw backend is the only one working for the game as SDL has only been used so far for building tools.
>>
New thread: >>58661502
>>
>>58661496
That's so cool
>>
New thread:

>>58661514
>>58661514
>>58661514
>>
>>58661484
vem tror du att jag ar?
>>
>>58661496
Yeah, show something or bust.
>>
>>58661358
Oh I'm so sorry man I didn't realize this was your board next time I ask a question I'll make sure to already know the answer before I post so as not to offend your superior abilities.
>>
>>58661583
It's far from ready for display as a lot of the engine is constantly changing.
>>
>>58661596
Show the code you're most proud of.
>>
>>58661612
kek did say it wasn't ready now didn't I?
Not really proud of this but it's the current thing I'm working on with
a forth like language used with a ring buffer and overflow/underflow
as tests take cycles... better to just use a mask when indexing the
array.
// old
struct Bytebeat *audioBytebeatNew();
void audioBytebeatReset(struct Bytebeat *);
void audioBytebeatDestroy(struct Bytebeat *);
void audioBytebeatPush(struct Bytebeat *, uint32_t);
uint32_t audioBytebeatPop(struct Bytebeat *);
void audioBytebeatStep(struct Bytebeat *);
void audioBytebeatFill(struct Bytebeat *, uint32_t, void *, enum BytebeatType);
void *audioBytebeatArray(char *, size_t, enum BytebeatType);
// new
void audioBytebeatCompile(struct Bytebeat *);
>>
>>58661240
if(bitPosition < sizeof(char)*8*bufByteSize)
{

Determines if the requested bit is in range. I'd probably complement this with an else{assert("invalid bit request");} or something.
int byteOffset= bitPosition/8;

Isolates which char we're dealing with
(if 0<bitPosition<8 this evaluates to 0, 8<bitPosition<16 this evaluates to 1 ...)
int bitOffset = bitPosition - byteOffset*8;

Isolates the "sub byte" index. Since we've gotten rid of the remainder of the division by 8 in our assignment to byteOffset, when we subtract from the original bitPosition all we get left is bitPosition%8.
Which is something I'd much prefer for clarifty. Must be written for a platform with very slow modulus and a rather fast division. (really making this a function with a branch and everything, and how general the prototype for this function is makes it not particularly well performing on modern machines).

if(value == true)
{

In the true case we want to set the bit to 1.
 buf[byteOffset] = buf[byteOffset] |  (1 << bitOffset);

shifts a bit into the bitOffset position and ORs it with the correct byte:
XXXXXXXX
00010000 OR
XXX1XXXX <- ensures that this is the case
else
{
buf[byteOffset] = buf[byteOffset] & ~(1 << bitOffset);;

Probably easiest to understand with an example
(1<<4):00010000
~00010000:11101111
XXXXXXXX
11101111 AND:
XXX0XXXX
 }

Closing Else scope
 }

Closing if scope
 }

Closing function scope
>>
>>58661702
Actually having looked into it. Modern CPU's don't actually have mod instructions.
I thought they did. Maybe they never did?
http://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf
Anyway the division instruction has two results. The quotient and the remainder.
So really there's no reason at all to use division this way it seems.
>>
>>58660223
>do not pass random functions into map directly
What the fuck? That's exactly what map is for. I rarely pass lambdas into it. Regardless, there should be no semantic difference between lambdas and named functions, particularly in perhaps the most commonly-used higher-order function: map.
>>
Sup, /g/. I want to learn Ada to increase my chances of getting hired at a defense firm. I'm proficient in C/C++ and have experience with programming microcontrollers in C. I'm also pretty knowledgeable with Java, I just haven't used it in forever.

My question is, what exactly should I do to go about learning Ada? For Java and C++, it was part of coursework and then extended into personal projects. I have no clue what to do with Ada. What practical uses does it have for personal projects?
Thread posts: 321
Thread images: 53


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

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


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