[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: 29
File: ddd.png (1 MB, 685x1566) Image search: [Google]
ddd.png
1 MB, 685x1566
What are you working on, /g/?
>>
File: fsharp code quotation.png (3 KB, 278x41) Image search: [Google]
fsharp code quotation.png
3 KB, 278x41
It's easy to average 2 ints in F#
>>
>>52957993
>>52957993
>someone makes pull request adding code of conduct
>afraid of getting banned from github and having my professional reputation trashed by insane SJWs
>accept pull request and pretend to agree with her so she'll go away

This is what's happening.
>>
>>52958046
sudo -dpt damage_control
>>
If their gender is not identifiable how did they find out their gender?
>>
>>52958046
use BitBucket

can't go wrong with Atlassian
>>
File: mfw.jpg (11 KB, 200x200) Image search: [Google]
mfw.jpg
11 KB, 200x200
>>52958063
>If their gender is not identifiable how did they find out their gender?
>>
>>52958063
Through the sheer power of flawed methodologies.
>>
>>52958063
If someone has a girly anime avatar, it is safe to assume that it is a girl.
>>
>>52958064
They added a code of conduct too.
The mere fact that C+= and the Feminist Software Foundation have gotten booted multiple times means it's not the CoC-free safe-space you thought it was.
>>
>>52957993

>research is not peer reviewed

>subject platform is a community currently best know for being embroiled in a gender and identity politics controversy

>nonconforming to github gender politics will result in expulsion

>sample size is not listed
>>
>>52958112
still much better than github
>>
File: heh.png (362 KB, 523x592) Image search: [Google]
heh.png
362 KB, 523x592
>>52958099
>those faggots thought I was a girl and used my github activity to promote women
>>
>>52958112
Why do those github faggots crave CoCs so badly?
>>
>>52958133
The sample size is in the paper - it was something like this:
Women - 10 thousand
Men - 150 thousand
>>
>>52957993
my old post in /dpt/
pls reply


can anyone recommend me a good code editor which is not vim but supports vim's gg=G, i.e. "indent a whole file" functionality. Thanks. I have tried atom's ctrl-shift-i but it's completely shit.
>>
>>52958159
ctrl+A
tab
>>
>>52958144
someone post the "triggering phallic eggplant" comment thread picture

you know the one
>>
>>52958159
Emacs.
C-x h tab.
>>
>>52958099
>girly anime avatar
that's like writing "fat butter" or "wet water"
>>
File: 1454301559858.gif (2 MB, 651x367) Image search: [Google]
1454301559858.gif
2 MB, 651x367
>>52958159
>being this afraid of vim
>>
>>52958192
what if you have a bishie anime avatar?
>>
>>52958192
I disagree, there are plenty of manly anime out there.

For example, Naruto and One Piece.
>>
>>52958159
You mean auto indent or indent + 1
>>
>>52958170
nah mate gg=G is much more than that.
try saving this as something.c

#include <stdio.h>

int main(){
int a;
if(1)
if(1)
if(1)
if(1)
a=1;

return 0;
}

in terminal type:

vim something.c

and then type gg=G quickly.
>>
>>52958219
>plenty of manly anime
Yeah anon, agreed, for example Bers...
>Naruto
oh now you're trolling.
>>
>>52958234
See >>52958183
Exact same thing. If you only want to do this one thing, C-x-s to save afterwards and you're done.
>>
>>52958201
I am not afraid, just hate the lack of scroll bar.
Also running kde so gvim doesn't look very pretty.
>>
>>52958063
>If their gender is not identifiable how did they find out their gender?

>Specifically, we extract users’ email addresses from GHTorrent, look up that email address on the Google+ social network, then, if that user has a profile, extract gender information from these users’ profiles. Out of 4,037,953 GitHub user profiles with email addresses, we were able to identify 1,426,121 (35.3%) of them as men or women through their public Google+ profiles. We are the first to use this technique, to our knowledge.

https://peerj.com/preprints/1733.pdf
>>
>>52958282
>1,426,121
wow, that's like 100x increase since the last time I looked at google+
I guess the "must use g+ to shitpost on youtube" bait worked perfectly
>>
>>52958262
>>52958183
will check that out.
>>
>>52957993
>image
http://slatestarcodex.com/2016/02/12/before-you-get-too-excited-about-that-github-study/

>>52958046
You won't get banned from Github for rejecting a pull request that includes a code of conduct. I personally would outright reject such a pull request on any of my repositories.

>>52958063
They wrote a script to look at the user's Google+ page. I guess they don't consider people who don't participate in social media to be worth taking into account. If Richard Stallman had made a pull request on the day they ran their script, he would not be counted in the study.
>>
>>52958357
>You won't get banned from Github for rejecting a pull request that includes a code of conduct.

But then she'll dox you on twitter and then have them call your employer/clients that you raped them and destroy your reputation, all to make sure you're never able to work in the software industry ever again/.
>>
>>52958357
It also doesn't count people who keep separate email addresses for their social networking and professional lives.
>>
>>52958264
Konsole?
>>
>>52958144
because they want to own the services
>>
>>52957993
Writing test for a websocket handler in Go.
>>
File: snapshot3.png (108 KB, 1600x870) Image search: [Google]
snapshot3.png
108 KB, 1600x870
>>52958421
notice the height of the scrollbar.
>>
why are there two versions of python
why don't they deprecate the older one
>>
>>52958357
even worse, the study relies on already existing data with 0 control. they just found all the different female users and then compared
maybe the people who use GitHub for popularity are shitty programmers and the people who use it to write actual code don't care about whether people can see their best selfie on their GitHub profile
>>
>>52958264
what do you need a scrollbar for?
you can use the scroll wheel if you like and it tells you the position in the lower right corner
>>
>>52958264
what about
https://github.com/equalsraf/neovim-qt
>>
My coworker got fired. On a personal level, I feel bad for him because he was a nice guy. On a professional level, I'm glad. He sucked at programming and always held me back because he argued against every god damn thing I wanted to do.

This guy wasn't that good at programming. I had to redo everything he was assigned because it was so broken. He would take weeks to finish a task and when I went to redo it, I could get it done in a day. English is his native language, but he sucked shit at naming things. You never had any fucking clue what his methods would do unless you looked at the implementation. Things which looked like simple getters or setters would have wild side effects. Methods which looked like they performed work would really be simple state checks to return a boolean.

He was so inconsistent with naming that he even had an entire application with 3 different names for it. One name in Subversion, a different name in Jenkins, and a third name when deployed to the box.

This guy would also remove so many features that GNOME and Mozilla would blush. I had spent about 3 days working on a prototype for a new application. My boss moved me to a higher priority project, so my coworker was given my 3 days worth of code to continue working on it. Two months go by and the application is missing half of the features it initially had while providing no new ones. The features he did keep had new bugs and required three times as many mouse clicks to access. He had no sense of usability. In addition to making the thing more annoying to use, he also made it uglier. He turned some widgets baby-blue and others a horrible shade of orange. I'm convinced he had a form of color blindness and didn't realize it.
>>
>>52958625
>neovim-qt
>>
>>52958046
>being a ruby "programmer"
>>
>>52958596
because they changed it so much programs written in 2 won't be able to run at all in 3
>>
Here's a question I'm stuck on. I was hoping someone could help.
I have a distributed nltk based nlp running on execnet. Yet when I run runner.py it ends up[ tagging letters instead of whole words. Does anyone know why?
runner.py:
 
#!/usr/bin/env python2
import execnet, itertools
import nltk.tag, nltk.data
import cPickle as pickle
from nltk import sent_tokenize

import remote_tag

def map_tags(mod, tag, args, specs=[('popen', 2)]):
gateways = []
channels = []

for spec, count in specs:
for i in range(count):
gw = execnet.makegateway(spec)
gateways.append(gw)
channels.append(gw.remote_exec(mod))
channels[i].send(tag)

cyc = itertools.cycle(channels)
for i, arg in enumerate(args):
channel = cyc.next()
channel.send((i, arg))

mch = execnet.MultiChannel(channels)
queue = mch.make_receive_queue()
l = len(args)
results = [None] * l
for j in range(l):
channel, (i, result) = queue.get()
results[i] = result

for gw in gateways:
gw.exit()

return results

tagger = pickle.dumps(nltk.data.load('taggers/maxent_treebank_pos_tagger/english.pickle'))

fp = open("2601.txt")
data = fp.read()
sentences = sent_tokenize(data)

for tag in map_tags(remote_tag, tagger, sentences):
print tag


remote_tag.py:
#!/usr/bin/env python2
import cPickle as pickle
import nltk.tag
if __name__ == '__channelexec__':
tagger = pickle.loads(channel.receive())

for (i, arg) in channel:
channel.send((i, nltk.tag._pos_tag(arg, None, tagger)))
>>
>>52958701
2601.txt:
A Markov chain is a stochastic process with the Markov property.
The term "Markov chain" refers to the sequence of random variables such a process moves through, with the Markov property defining serial dependence only between adjacent periods (as in a "chain").
It can thus be used for describing systems that follow a chain of linked events, where what happens next depends only on the current state of the system.
In the literature, different kinds of Markov process are designated as "Markov chains".
Usually the term is reserved for a process with a discrete set of times, i.e. a discrete-time Markov chain (DTMC).
On the other hand, a few authors use the term "Markov process" to refer to a continuous-time Markov chain without explicit mention.
While the time parameter is usually discrete, the state space of a Markov chain does not have any generally agreed-on restrictions: the term may refer to a process on an arbitrary state space.
However, many applications of Markov chains employ finite or countably infinite (that is, discrete) state spaces, which have a more straightforward statistical analysis.
Besides time-index and state-space parameters, there are many other variations, extensions and generalisations (see Variations).
For simplicity, most of this article concentrates on the discrete-time, discrete state-space case, unless mentioned otherwise.
>>
>>52958625
looks nice, thanks

>>52958623
If a block of code is so big that not all of its lines can be displayed on the screen at a time, and I want to know its opening curly brace, I usually place the cursor at the ending curly brace and use the scrollbar to scroll up until I see a highlighted brace.
>>
>>52958751
http://vim.wikia.com/wiki/Moving_to_matching_braces
>>
>>52958825
That's perfect. It seems I was just afraid after all.
>>
>>52958715
Why use so many complicated words to describe such a simple concept?
>>
>>52958891
I got it from wikipedia. It's just a smaple text i'm using
>>
So gee, did you ever manage to average those two ints?
>>
>>52958935
to three decimal accuracy?
>>
>>52958935
>>52958015
>>
What's a good term to cover "plane", "sphere" and "triangle mesh"?
Trying to come up with a good umbrella name for a base class but I can't seem to think of a good one. There must be a proper term for this, right?
Geometric object or something?
>>
>>52959106
Surface
>>
>>52959106
polygon
>>
>>52959106
Surface
>>
>>52959106
hypervolume

plane is an area
sphere is a volume
triangle mesh is a volume
>>
>>52959163
Already used for something else beyond my control.
>>52959164
A plane and sphere are not polygons, and a triangle mesh consists of many polygons.
>>
I'm stuck with a shitty computer.

Can't play games.

Can't do shit aside from browsing the internet.

I'm also forced to use Linux because Windows 7 works like shit on this computer, so even if there was a game that could work it wouldn't be compatible.

My only thing left to do for fun is coding, but aside from making my own engine from scratch or doing CLI-based shit I don't seem to find a way to make a videogame, so I just give up (I like to develop videogames or shit that is interactive in some way aside from calculators and such), and getting a full fledged engine is beyond my scope due to shit-computer and compatibility problems.

I always wanted to make a doom-like game.

Will I experience hell on earth if I try? I'd use C++.
>>
>>52958715
I know nothing about the topic, but I installed the dependencies and tried your code, then added
sentences = [x.strip().split(' ') for x in sentences]

after
sentences = sent_tokenize(data)

and got this:
[('A', 'DT'), ('Markov', 'NNP'), ('chain', 'NN'), ('is', 'VBZ'), ('a', 'DT'), ('stochastic', 'JJ'), ('process', 'NN'), ('with', 'IN'), ('the', 'DT'), ('Markov', 'NNP'), ('property.', 'NNP')]
[...]

is that what you needed?
>>
>>52959195
maybe they shouldn't inherit from the same superclass and have other classes in between
>>
>>52959106
>plane
>sphere
>triangle mesh
Closed Manifold, if you want to get mathy.

The "closed" part is really important if you want to ensure that the mesh doesn't have any holes in it.

But if it's for a "base class" i.e. programming, then you should just call it a "Mesh", because this encompasses all 3D edge-connected point clouds.
>>
>>52959248
How is a triangle mesh a manifold?
>>
>>52959264
Any mesh in the finite space is a closed manifold.
A mesh is considered a surface, which is a subset of manifold.
>>
>>52959274
Do you not consider the volume to be a part of the mesh?
>>
>>52959298
There are such things as 2-manifolds.
>>
>>52958935
public static int avg(int a, int b) {
BigInteger sum = BigInteger.valueOf(a).add(BigInteger.valueOf(b));
return sum.divide(BigInteger.valueOf(2)).intValue();
}
>>
>>52957993
I'm trying to install UE4 on a cheap Debian sid laptop so I can make baby's first 3D game.

It'll probably be hell just getting the thing running.
>>
>>52959308
A volume in 3d space isn't a manifold
>>
>>52959343
Why not Unity?
>>
>>52959343
>trying to install UE4 on a cheap Debian sid laptop
You might want to just stick to Unity instead.
>>
>>52959337
avg(3,4) == 3.5
>>
>>52959351
>implying manifolds don't have volume
They're literally the most generic description of objects in space
>>
>>52958395
Sure lmao
>>
>>52958357
>You won't get banned from Github for rejecting a pull request that includes a code of conduct. I personally would outright reject such a pull request on any of my repositories.
Yeah, and Mickey Mouse got three ears.

There's three things that are pretty easy to avoid here in life. GPL, AIDS and Github.

Github: Not even once.
>>
>>52959368
>>52959371
But then I'd have to use >C#, and that just sucks ass on Linux.
At least Unreal is in C++.
>>
http://pastebin.com/mK3qWZ0Q

Am I making an logic error here? Im just checking if an 2 arrays are the opposite of each other. I have to do this in some online homework thing so its getting upset I'm using a continue; line, but I'm not sure how else to do this.
>>
>>52959343
Installing Nvidia proprietary drivers on Debian probably isn't so bad.
Depending on how niche your setup is, it could get harder.

Max difficulty seems to be installing them on Secure-Boot enabled Fedora
>>
>>52959397
nvm i didn't understand manifolds
I thought they had to be embedded in higher dimensions
>>
>>52959452
Haha you're a funny one.
I'm running on a cheap ass laptop, trying to make a minimal game. I have 8GB, 2 cores and an Intel chipset.
>>
>>52959420
Unity uses Mono, not .NET Framework.
Unity with C# on Windows is identical to Unity with C# on loonix.

This may change in the next few years since Microsoft open sourced the .NET Core and Roslyn compilers.
And I mean "next few years" because Unity devs are slow as fuck.
>>
>>52959420
Unity C# is the same on all platforms. It uses mono, C# isn't the only language you have to use, but you computer is too shitty for UE4
>>
>>52959448
bool isReverse(int forward[], int backwards[], int parSize)
{
for(int x = 0; x < parSize; x++)
{
if (forward[x] != backwards[(parSize - x)])
{
return false;
}
}

return true;
}
>>
anyone knows how to "download" a form? like, download every option in text or sql form
>>
>>52959448
have you stepped this through a debugger?

you're getting parsize, let's say for example it's 5, so your array indexes are 0, 1, 2, 3, 4, the first loop tries to access backwards[5] which is outside the bounds of the array
>>
>>52959482
>>52959485
I've had some experience with Unity's Linux support and it's pretty sad.
The native linux version of a release game runs a couple times slower and has way less driver features supported than the Windows version run through Wine.

I'd rather go with UE4 and sepples because I really need to squeeze that last cycle and that last byte if I want the thing to even run on my crap hardware.
>>
>>52958395

>she'll dox you on Twitter
My email address on my github does not have any associated accounts with irl information. I do not have ANY Facebook account. Pinpointing me to a specific person might be a bit difficult, because the only areas where my real name exists on the internet are on sites I have used to pay for stuff, and on all of these sites, I have used a different email.

Furthermore, it would be very difficult to make a case against me for rape. I do not interact with a large number of people in my typical day. I go to school, go to work, come home, and do homework. I am very rarely in private with anyone other than either my family or my boss. I am, however, often communicating online, and my communication has an associated identity and timestamp. Thus, an easy counterargument would be "how could I? I was in class at the time? I was shitposting at the time? I was at home at the time?" If they nonetheless chose to make such accusations anyways, they would find themselves on the end of a very, VERY large libel suit, and I would use the winnings to pay off my college debt.
>>
>>52959375
public static BigDecimal avg(int a, int b) {
BigDecimal sum = BigDecimal.valueOf(a).add(BigDecimal.valueOf(b));
return sum.divide(BigDecimal.valueOf(2), 1, BigDecimal.ROUND_UNNECESSARY);
}
>>
>>52959491
pretty sure in C++ you put the brackets on the type, not the variable name
>>
>>52959552
that looks like the average of two BigDecimals
>>
>>52959545
Like I said, you're going to have to look for an alternative anyways, UE4 isn't for shit hardware, it was designed for next-gen.
>>
>>52959570
It prints fine, you can convert it to float or int if you'd like, but it gives you perfect results every time.
>>
>>52959491

is this C++17?
no array params in C++14 afaik
>>
>>52959566
You're thinking of Java.

>>52959573
You might be right, but I'd like to at least try before going back to Unity or ... fucking Ogre3D
>>
>>52959595
that's fucking C
>>
>>52959591
you're averaging two big decimals tho
>(BidDecimal + BigDecimal) / BigDecimal
the code looks horrible too
>>
>>52959595
Never heard of array-to-pointer decay?
lrn2c
>>
>>52959605
they look the same senpai
i assumed you weren't using a deprecated language
>>
>>52959609
That's what happens when you want PERFECT results. It takes two ints though. It was supposed to be horrible if you couldn't tell.
>>
>>52959626
You're a fucking retard.
>>
>>52959626
That's a pretty weak excuse for not knowing your own language. All versions of C++ have always had that.
>>
>>52959626
I'm not that guy and I don't use deprecated languages
>>
>>52959636

ok f.am
>>
>>52959643
wow then I guess C has nothing on C++
>>
>>52959655
>>52959671
>advertising a deprecated language
>>
>>52959671
C has the advantage of compiling on any toaster under the sun. You can't really say the same of C++14, but that's about it.
>>
>>52958751
Highlight a brace
Shift + 5
Watch as your cursor magically jumps to the matching brace
:^)
>>
>>52959529
BUMPAN my TOAST
no kind anons can help me?
>>
>>52959748
copy the html?
>>
>>52959617
>not using a pointer type
We really should talk about bringing ISHYGGDT back.
>>
File: 1714608.jpg (837 KB, 950x973) Image search: [Google]
1714608.jpg
837 KB, 950x973
>>52957993
If I have these shaders
    const GLchar *vs_source =
"#version 440\n"
"layout(location = 0) in vec3 vp;"
"layout(location = 1) in vec2 vt;"
"out vec2 texcoord;"
"void main() { gl_Position = vec4(vp, 1.0);"
"texcoord = vt; }",
*fs_source =
"#version 440\n"
"out vec4 frag_color;"
"in vec2 texcoord;"
"uniform sampler2D texture;"
"void main() { frag_color = texture2D(texture, texcoord); }";


How do I change this to render something bound to GL_TEXTURE1 and not GL_TEXTURE0?

I'm trying to get to a point where I can switch between bound textures but I can't quite grasp GL shaders.
>>
>>52959771
Don't blame the messenger
>>
What design patterns have you guys found useful?
>>
Requesting pic with funny code. There was a guy with a degree on that pic.
>>
>>52959833
KISS
>>
>>52959833
The no-design-patterns pattern
Repeating code is a sin
>>
File: Bwrfr2hCcAAm7or.jpg (31 KB, 600x692) Image search: [Google]
Bwrfr2hCcAAm7or.jpg
31 KB, 600x692
>>52959833
found
>>
File: degree with code.png (220 KB, 635x365) Image search: [Google]
degree with code.png
220 KB, 635x365
>>52959843
>>
>>52959231
holy fuck. You are amazing
>>
Does anyone know the best place to find internships for CE majors?
>>
>>52959983
Are you white and/or an American Citizen?
Join your local defense contractor today!
>>
File: stop.png (25 KB, 640x394) Image search: [Google]
stop.png
25 KB, 640x394
>>
>>52959983
>tfw no HTTPS
http://mcdonalds.com
>>
>>52959983
the third world
>>
>>52960026
did it yesterday
>>
>>52960027
I'm not clicking that unsafe link
>>
>>52960026
>>
>>52959700

GCC and Clang have been ported to a large enough number of platforms that your toaster will probably support it anyways.
>>
>>52960026
I'm under a NDA
>>
File: snap18.jpg (238 KB, 1366x768) Image search: [Google]
snap18.jpg
238 KB, 1366x768
>>52960026
I'm rebasing my stripped-down Tor fork to v1.8
>>
>>52960119
Then I guess you've got to stay stopped for the length of the NDA
>>
File: maxresdefault.jpg (140 KB, 1440x1080) Image search: [Google]
maxresdefault.jpg
140 KB, 1440x1080
>>52958112
>They added a code of conduct too.

i don't think so tim.
>>
>>52960150
see you in 9 years
>>
>>52960134
>Roger Dingledine
>>
>>52959977
hey, I'm glad I could help you :)

>>52960026
nice try, NSA
>>
>>52960179
What about him?
That's the guy who wrote Tor, not my name.
>>
>>52958634
>female programmer detected
Thanks for the blog post sweetheart.
>>
>>52960195
Nigga you serious? Is that a legit surname?
>>
Webserver application in web.py its awesome its not writing it in django or pyramid or anything I'm just writing it in python using all the python libraries as I need handling the requests procedurally
>>
>>52959977
btw, you don't actually need ".strip()", that only removes newlines and spaces
>>
>>52960098
>no highlighting
>go
Literally worst. Ever.
>>
>>52960217
pretty sure .strip() only removes clothes
>>
File: arma.jpg (23 KB, 400x600) Image search: [Google]
arma.jpg
23 KB, 400x600
>>52960206
Don't talk shit about arma mate

https://en.wikipedia.org/wiki/Roger_Dingledine
>>
File: syntax highlighting.jpg (44 KB, 600x291) Image search: [Google]
syntax highlighting.jpg
44 KB, 600x291
>>52960234
>>
>>52960026
>>52958935
def avg *numbers
numbers.reduce(:+) / numbers.size unless numbers.size == 0
end
>>
File: QASOJat.gif (400 KB, 493x342) Image search: [Google]
QASOJat.gif
400 KB, 493x342
What is /dpt/'s favorite language for server-side shit?
>>
>>52960318
AngularJS
>>
>>52960318
Anything I know. The whole best language thing is a meme, there is no best language, unless it's Erlang.
>>
>>52960318
Python if you don't give a shit, C++ with Facebook's libraries if you have ambition.
>>
>>52960234
Syntax off is easier on my eyes. Otherwise it feels like looking to a Christmas tree.
The only thing I miss about syntax highlighting is the ending quote for strings. For some reason I keep forgetting the end quote.
>>
>>52959748
It would help if you elaborated on what, exactly, you are trying to do or gave a specific, concrete example.
>>
>>52960340
I have ambition.
>>
>>52960318
Java/C#
>>
>>52960286
nice
will look into ruby
how does it perform
>>
>>52960378
https://code. ##FB### .com/projects/676603015770415/proxygen/

https://github.com/facebook/proxygen
>>
>>52960333
>server side
>AngularJS
wat
>>
Why does this work:
float convertedTemp = (temp - 32)*5/9


and this doesnt:
float convertedTemp = (temp - 32)*(5/9)


im working in java. I really dont understand this. Am i just retarded or is java wrong?
>>
>>52960415
http://benchmarksgame.alioth.debian.org/u64q/ruby.html
>>
>>52960431
>working in java
found your problem :^)
>>
>>52960431
If temp is a float, then (temp - 32) is a float, and (temp - 32)*5 is a float, and everything works as expected.

In the second case 5/9 is integer division and the whole thing becomes 0.
>>
>>52960431
5/9 is 0
>>
>>52960431
is temp a double? if so, that's the reason. in (5/9), you are applying integer division, while
(temp - 32)*5/9
means "multiple (temp - 32) (an integer) by 5, divide the result by 9"
>>
>>52960318
Leraning Nodejs for serverside shit. Even though Javascript has quite a few flaws], it's still pretty good.
>>
>>52960431
>Am i just retarded or is java wrong?
The computer is never wrong.
This is the one wonderful thing about computers, if it doesn't work it means YOU FUCKED UP because hardware is perfect*

(*mostly. sort of. not really. blame Intel)
>>
>>52960415
Well enough, but it's not designed for performance.
>>
>>52960415
Like shit, there's nothing slower.
>>
>>52960318
Python because lazy and I don't expect to have a million users
>>
>>52960286
>:+)
Kill yourself.
>>
in C++, when using inheritance, is it possible to have the initializer lists of the entire hierarchy execute before any constructor body gets called?
Cause I have something like the following structure:

class Base {
protected:
Base(int a)
: a_(a)
{ someFunction(); /* sets someVar_ */ }

virtual void someFunction() = 0;
int a_
int someVar_;
}

class Derived {
public:
Derived(int a, int b)
: Base(a)
, b_(b)
{ }

private:
void someFunction() { /* set someVar_ using a_ and b_ */ }
int b_;
}
>>
>>52960318
I don't give a fuck, python
>>
>>52960456
but why would it be an integer division when i defined the variable as a float?
>>52960469
temp is not a double
>>52960476
Programming languages have bugs...
>>
>>52960527
whoops, forgot to inherit from Base there.
>>
>>52960439
wow
nevermind
>>
Holy shit Octave debugging is fucking retarded.
>>
>>52960545
ruby/python will never be as great as luajit
>>
>>52960527
Does that not do what you want?
>>
>>52960540
>but why would it be an integer division when i defined the variable as a float?
The compiler doesn't give a shit that you're writing into a float.
(5/9) is integer division, the result is 0, no matter what. Write (5.0/9) instead.

>Programming languages have bugs...
They don't. Not at the level you're at.
You don't even know the basics of the language, a random tool has more chance of finding a compiler bug than you.

If your code doesn't work, it'll be your fault 99.99999% of the time, not the compiler.
>>
Dont know if this is the place but have some question.

I am making a map generator that basically do this.

1- generate one tile of the map
2-add the (NOT generated yet) adjacent tiles of this tile to list A
3-search on list A for the tile with most amount of ALREADY generated tiles.
4-generate this tile based on adjacent tiles
5-remove this tile from list A
6-go back to 2 unless you already generated all tiles of the map


Anyway, step 3 is really needed (because its better when the tile you generate is based on alot of adjacent tiles), but this takes alot of time.

Any idea on how to speed up the process.
This is actually a speed up version, since step 2 was not present on previous version and so it had to search betweeen all not generated yet tiles to find the one with most amount of already generated tiles. But I cant think of any idea to speed up the process.
>>
>>52960373
ok, say this site: https://www.autoscout24.com/
how would I go about downloading a list of every make and model present in the main searh form?
>>
>>52960545
Ruby is good because it's fun to use and quick to write, but iff performance is what you're looking for, you should look elsewhere.
>>
>>52960540
Ok same guy,
i did test where i defined:
Float tryout = 5/9;

and you were right. For some reason it just doesnt want to accept the fact that i want a number and not a "can't do it because its an integer"
>>
>>52960527
nice pure virtual call you got there m8
>>
>>52960615
He should protect it with his life
>>
>>52960574
I know, I'm retarded.
>>
>>52960613
God dammit you're such a fucking idiot, it's hopeless.

It's not that "it just doesnt want to accept the fact", the problem is that YOU ARE WRONG and don't know the language, how hard is that to accept for you?
>>
MethodNameInC#
methodNameInBetterLang
fn_best
>>
>>52960563
Haven't tried it yet, but I looked into it a bit and apparently the order of execution is
>initializer list
>constructor body
for every class from top to bottom in the hierarchy.
What I want is a pass over the initializer lists first, and execute the constructor bodies *after* everything is initialized
>>
>>52960613
5 and 9 are both integers, you are doing integer division. define one of them as a float, like 5.0/9 and it'll be fine
>>
>>52957993
I wish she would have removed her shoes ;_;
>>
>>52960645
... yes, that's what happens
>>
>>52960645
>What I want is a pass over the initializer lists first, and execute the constructor bodies *after* everything is initialized
That would be UNDEFINED BEHAVIOR of the worst kind, and it's obviously impossible.

The language won't let you do anything with Derived until the constructor of Base has run. All of the constructor, not just the init list.

Object initialization order is a cornerstone of the language.
>>
>>52960645
>What I want is a pass over the initializer lists first, and execute the constructor bodies *after* everything is initialized
not possible
use a factory and an init method
>>
>>52960630
I know, i was just trying to figure out what was happening and why.
>>
>>52960671
>>52960674
hmkay, guess I'll have to do this a bit differently then. Thanks.
>>
>>52960652
Thanks, i get it now. I'm going to bang my head against a wall.
>>
>>52960689
>>52960671

What the fuck are you talking about?
Isn't that what you just said?
What?
>>
>>52960583
Why not just generate them in a spiral pattern? Most tiles will have two tiles to base their generation on that way and you don't have a piss-poor performing convoluted method you have now.
>>
>>52960708
what?
>>
>>52960664
Feetfags are the worst.

>>52960677
When you write an assignement like this:
float plop = (expression)


The compiler computes the expression first. While computing the expression it doesn't care about the type of plop.

If the expression is (5/9), 5 and 9 are of type int, so / is the integer division, and the result is 0.
If you write either 5.0/9 or 5/9.0, / will be the floating point division and both numbers will be converted to double, giving the result you expect.
>>
>>52960731
>The compiler computes the expression first. While computing the expression it doesn't care about the type of plop.
That makes a lot of sense actually, thanks man.
>>
>>52960583
If the map is made up of squares and they're all empty at the beginning you should just start from a corner and simply generate them tile by tile, row by row. This way your constraint is always satisfied.
>>
>>52960026
>>
>>52960731
What the fuck is a "plop" anyway, anon?
I know about foos, bars and foobars, but "plop"?
>>
>>52960318
c#
>>
>>52959775
You switch that with glActiveTexture and glBindTexture and then make sure to pass the new id to your glUniform("texture") as well.
>>
>>52960919
I think he is belgian/dutch because there it is a tv character (a dwarf)
>>
>>52960919
a shit
>>
>>52960919
That's my word. Copyright© Anon 2012, license deals available.
It means "sup fag", "<placeholder>", or whatver else you want.

>>52960963
Close, france. And I never heard anyone on TV say it.
>>
>>52960982
Here he is a pretty popular guy. search for the "plopdans"
>>
>>52960929
>stephen spielsperg
>>
File: Selection_004.png (126 KB, 519x293) Image search: [Google]
Selection_004.png
126 KB, 519x293
So THIS is what they meant when they said "logic & design errors are more dangerous than compile errors."
>>
>>52961042
you taught your program Common Core?
>>
>>52961064
Apparently.
>>
>>52961042
You're good, you just need to special-case the 1X numbers for the last 2 digist and use the general algorithm the rest of the time
>>
>>52961042
It's just a japanese program
https://youtu.be/oGXcLoA8pGo?t=8
>>
>>52961042
The best programs are the ones that only crash at a random time on Sundays only
>>
>>52960919
Is that anything like a ``````FROB''''''?
>>
>>52961042
>>52961042
>94
>eighty four
>>
>>52961097
Reminds me of the bug where OpenOffice wouldn't print on Tuesdays, the explanation was some contrived mindblowing bullshit.
>>
>>52961105
Not really, you can't use it as a verb. But that's the spirit.
>>
>>52958046
>being this paranoid
what's actually happening is nothing, the "study" was a shitty non-peer reviewed undergraduate paper by some CS majors. the news articles are science journalism being shit as usual.
http://slatestarcodex.com/2016/02/12/before-you-get-too-excited-about-that-github-study/
>>
File: emacs@arch_005.png (487 KB, 1227x1051) Image search: [Google]
emacs@arch_005.png
487 KB, 1227x1051
>>52961090
>general algorithm
uh...about that...
>>
File: meh magazine.jpg (213 KB, 540x703) Image search: [Google]
meh magazine.jpg
213 KB, 540x703
>>52958015
still has to go through the same procedure as every other language

so much for shitposting

hey /dpt/ I'm in a bit of a crisis
I have no work for the next 6 months and I need fun projects to work on to keep my sanity
c/c++, java, python, scala, android apps >inb4 mad flames
>>
File: it's ok.jpg (139 KB, 600x997) Image search: [Google]
it's ok.jpg
139 KB, 600x997
>>52961170
>>
>>52961170
If you ever have your cases in numerical order, just instead have an array of strings in the proper order and index it through the array.
>>
>>52961188
there's no overflow, underflow, loss of precision, casting or loss of result accuracy
>>
>>52961206
Ooh, that's a good idea anon.
>>
>>52961188
I would tell you to come work on Tox with us, but I'm so out of it I don't even have time to merge my pull requests...
>>
>>52961170
>you fell for the using meme

Seriously, just write std:: every time pleb
>>
>>52961210
yeah and that's thanks to all the magic behind the fancy function name you can break down to code you can write in every other language
>>
>>52961273
That's retarded, just use the whole namespace unless you're actively using libraries that you know might conflict.
You're like those fanatic preachers that religiously hate goto because someone told them to.

Think for yourself.
>>
>>52961284

There's nothing fancy, just arbitrary precision.
>>
>>52961305
>telling me what to do
>think for yourself
>>
>>52961284
?
>>
>>52961320
it's complete precision not arbitrary precision
i couldn't lower the precision, for instance
>>
>>52961333
Good.
Now if you actually have a reasonned opinion, I'll be happy to hear your side, because hating on using declarations is a gross overreaction.
>>
>>52961305
you're talking to a /g/ programming drone

they once overheard their professor rant about a language or praise haskell and that using namespace is bad and now they live by that shit
>>52961336
if that's too complicated for you I can't help you either
>>
>>52961376
maybe you should reword what you said but properly and intelligibly
>>
>>52961397
ok
>>52958015
behind that function name is ordinary computer you can rewrite in any language you want
>>
>>52961440
>behind that function name is ordinary computer
>>
>>52961440
computer code* ...
>>
>>52961440
you can't average 2 ints this easily in other languages though
>>
JS question:

I have an array of arrays. How do I alphabetically order the arrays, based on the string values located at index 1 of each sub-array?

    [2, "Hair Pin"],
[3, "Half-Eaten Apple"],
[67, "Bowling Ball"],
[7, "Toothpaste"]

// alphabetized
[67, "Bowling Ball"],
[2, "Hair Pin"],
[3, "Half-Eaten Apple"],
[7, "Toothpaste"]
>>
>>52961473
>>>/wdg/
>>
File: capture2.png (271 KB, 495x567) Image search: [Google]
capture2.png
271 KB, 495x567
>>
>>52961460
Sure you can, they all have libraries for that if you're too stupid to write the code yourself.
>>
>>52961525
do it then
there's no overflow, underflow, loss of precision, casting or loss of result accuracy
>>
>>52961473
duplicate
http://stackoverflow.com/questions/5435228/sort-an-array-with-arrays-in-it-by-string
>>
>>52961473
std::sort(begin(array), end(array), [](auto& a, auto& b){
return a[1] < b[1];
}


Don't use a shit language ;^)
>>
>>52961473
arr.sort(function(a, b){ return a[1] < b[1] ? -1 : 1; });
Something like that.
>>
File: Capture.png (18 KB, 765x248) Image search: [Google]
Capture.png
18 KB, 765x248
Hey, im trying to sum up all the numbers in a 12 element array. Does someone know what to do with this stream thing cause i dont know why its not working
>>
>>52961578
>don't do it in a shit language
>posts C++

the fuck is this verbose bullshit
ranges when
functional when
Thread replies: 255
Thread images: 29

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.