/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

blog.molecular-matters.com/2014/11/06/stateless-layered-multi-threaded-rendering-part-1/
intel.com/content/www/us/en/diversity/diversity-in-technology-annual-report.html
economictimes.indiatimes.com/tech/internet/google-to-heavily-invest-in-india-train-two-million-developers-on-android-platform-sundar-pichai/articleshow/50200824.cms
twitter.com/NSFWRedditVideo

How to git gud ?

>when you realize Javascript is the best functional language

Thank you for using a Ritsuko image

rewriting the linux kernel in F#

Have you read your SCIP today?

lol it's true

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.

Neural net experiments.

>not haskell

What do you think of Scala?

I think JS is just accessible...

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?

>F#
scorn and laughter are the only reactions you deserve

whoops

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

just started reading it 5 minutes ago and I can already tell I'm gonna like it

You have to resolve that conflict yourself, either by using one of the two merges, or rewriting that part so they both work.

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.

>untyped

git has tools to automatically merge to files and on occasion you need to do it by hand.

git clone gud ?

attach a debugger

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, "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.

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.

Name 23 things wrong with git

How would I do that if my server is running on another machine?

attach to host:debug_port

Thanks user! Hopefully I'll find the problem.

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.

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

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.

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 user!!

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?

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.

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.

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.

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

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

blog.molecular-matters.com/2014/11/06/stateless-layered-multi-threaded-rendering-part-1/
This series will probably be of interest.

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.

It means they want to hire an H1B from india.
Don't apply.

What company?

Why doesn't Intel just write "need not apply, whiteboi" in their career website?

still better than hasklel

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.

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?

...

bump.

Or should I make it a thread ?

i'm confused between the . operator, the & operator and the -> operator

myVar++ increments myVar but has value before increment.
Do ++myVar.

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?

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?

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

x = x++ is undefined behavior.

...

use Float.floatToRawIntBits() (or Float.floatToIntBits()) and Float.intBitsToFloat()

Did you know 0% of their employees are Indian? Check for FACTS! intel.com/content/www/us/en/diversity/diversity-in-technology-annual-report.html

AAAND THERE IT FUCKING GOES AGAIN

NOT EVEN FIVE MINUTES AFTER REBOOT

NOW ANGRILY POSTING FROM FUCKING PHONE

>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?

>Sup Forums mad because they can't compete with pajeet

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

>they wasted 300m$ on pointless shit like that
wtf i hate intel now

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

promoting racemixing and degeneracy so they can enslave the world isn't pointless to them

db=munee

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.

CRUD is boring, but easy

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

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

economictimes.indiatimes.com/tech/internet/google-to-heavily-invest-in-india-train-two-million-developers-on-android-platform-sundar-pichai/articleshow/50200824.cms

if you're not learning C, you will never compete with pajeet

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.

Here's the mona lisa with a broken triangle rasterizer. I can't figure out how to get my god damn triangles working right.

how much trigonometry do you know

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.

it is not cross platform

That's pretty cool. Mind sharing the source? What's it written in, anyway?

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.

gibs me dat get, this is affirmative action

why would it, use C/C++ retard

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.

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

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.

no

employed Haskell programmer reporting in

...

then deal w/ it faggot. jni isn't even slow it's like 20 cycles for a call

Anybody got a degree in computer science?
I just finish my first class last semester and already I'm dreading the future

>javascript

Yes, it's depressing
Learn a trade instead, like carpentry

No I want to be a data scientist I can't quit now

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