[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: 36
Old thread >>54116487

What are you working on /dpt/?
>>
>>54121524
more efficient png optimizer
>>
>>54121524
Shitpost engine

If only I knew how to work with json files...
>>
I'm bored so i'm writing those r/dailyprogrammer challenges in assembly
>>
>>54121524
Trying to see if I can make a better app than the official one on the play store. Have to scrape a site, create a database of it, and create the android app to call the info. Am on the last part.
>>
>>54121555
How do you do IO?
>>
>>54121567
OpenCL. You have to create a parallel algorithm to make it work feasibly. That's the hardest part of it all.

>>54121587
I/O buffers just like in C
>>
>>54121554
Php turns them into associative arrays with a single call.
>>
>>54121541
Is this more related to crushing useless tags, better DEFLATE compression, filters application compared to the state of the art, or just reproducing it (maybe with better ergonomic features)?
>>
>>54121648
It's cool, getting a handle on it now (with python)

Actualy pretty simple. Programming is finally beginning to click with me
>>
>>54121524
Is that the trap from Steins;Gate?
>>
>>54121738
It's not a trap

>>54121698
>python
Wait until you get to a real programming language m8
>>
>>54121614
>I/O buffers just like in C
You perform syscall? What OS? What do you do exactly?
>>
>>54121750
You sure? I thought that show had a trap.
>>
>>54121783
There is a trap but it isn't her. https://www.youtube.com/watch?v=zdwR2jiADE0
>>
>>54121750
Like what m8
>>
>>54121855
Java
>>
>>54121766
https://www.freebsd.org/doc/en_US.ISO8859-1/books/developers-handbook/x86-buffered-io.html

>>54121855
C++, C, asm, C#, etc.
>>
>>54121891
>C++, C, asm, C#, etc.

>he managed to list off the most pointless languages on the planet

lmoa
>>
>>54121966
lel ok
>>
>>54121966
>Mandatory for any embedded design or reverse engineering enterprise
>"most pointless languages"
>>
>>54122014
>posts untitled, irrelevant rankings

Just because 42,000,000,000 pajeets use those languages driving up their ranks doesn't mean they're good or relevant in any way.
>>
>>54121524
Doing random codewars challenges.
Makes me realize how shitty I still am at programming.
>>
>>54122070
>embedded programming
rust.
>>
>>54122078
>TIOBE Index
>irrelevant

lol son http://www.tiobe.com/tiobe_index
>>
>>54122107
DO YOU SEE THIS

You're actually advocating rust for embedded systems. What the fuck dude
>>
>>54122110
Again, any PL rankings are irrelevant because they're skewed by shit companies who need to maintain their 80 year old codebases.

>>54122138
Yes, and it's better at it than any of your shit languages.
>>
>>54122156
>Rust
>better
HAHAHAHAHAHA
>>
>>54122168
ok, pajeet
>>
>>54122107
For now, if you globally exclude
>The availability and maturity of (standard) libraries for various kind of low-level applications
>The general stability compared to what is generally expected on this kind of platform
>The few MBs of runtime required for actual non-prototype programs
>>
>>54122156
That doesn't make them any less relevant. If they are maintaining their shit with it then it must be a relevant language. Your argument consists of damage control
>>
Pajeet here ask me anything
>>
>>54122253
Why C++?
>>
>>54122247
It seems you've forgotten what the original argument was about. He's asking what to learn, and because some ranking is skewed by legacy bullshit doesn't mean he needs to learn that legacy bullshit.

>>54122253
do you know java?
>>
>>54122253
Are you from India?
Are you actually named Pajeet?
Do you work as a freelance or in a services structure?
>>
>>54122272
>>54122274

I only know Java
>>
>>54122282
I am America
Yes, that is name
I do both
>>
Real pajeet here ask anything
>>
>>54122274
You are fucking delusional if you don't think C, C++, Java, whatever in that list are relevant languages. No language does program design better than those because they've been around for so long. Hasklel won't save you here.
>>
>>54122408
Java doesn't have any design
>>
>>54122479
nice mem
>>
>>54122496
it's true Java makes zero sense to treat everything like an object

shit language / 10
>>
>>54122513
Just because you don't understand OOP doesn't mean pajeet doesn't understand it. He'll take your job in fact.
>>
want to use python for web parsing. too noob and too lazy to learn.
>>
>>54122537
No one understands OOP it isn't as simple as they claim it to be you still get 2000 exceptions doing it. Please
>>
>>54122557
You need to learn about three methods: requests.get, str.split and string indices.
>>
>>54122603
thank you anon, will look into it. I'm an experienced beginner but do you think this might be too ambitious?
>>
File: charzarding-wtf-240x180.jpg (11 KB, 240x180) Image search: [Google]
charzarding-wtf-240x180.jpg
11 KB, 240x180
>>54122578
>no one understands it
>it's actually easy if you know anything
anon...
>>
>>54122655
OOP is not easy to learn properly anyone else telling you otherwise is a liar a quote from many of my professors
>>
>>54122708
I've learned it... it's easy anon...
>>
>>54122655
you probably think JavaScript is great and easy to learn too.
>>
>>54122749
Are you the retarded tripfag who doesn't know anything or...
>>
>>54122780
or?
>>
File: tumblr_nyt5immDdT1qze3hdo1_500.gif (405 KB, 500x288) Image search: [Google]
tumblr_nyt5immDdT1qze3hdo1_500.gif
405 KB, 500x288
Want to build out a few scripts for a m8 in python, but he doesn't know how to use command line (neither do his colleagues)

What's the best library for building a GUI with python?
>>
>>54122815
Tkinter is pretty good/easy
>>
File: php.png (21 KB, 1130x431) Image search: [Google]
php.png
21 KB, 1130x431
>>54122110
> php -0.02%
> positive change

site written in php detected
>>
>>54122913
>being this retarded
>>
>>54122913

Both are accurate. The change represents change in ranking, not in percentage of users. Since JavaScript dropped by more than PHP, it dropped in ranking below PHP despite PHP also dropping.

Make sense now?
>>
>>54122913
Java number one that's right /dpt/ and /g/ you guys know nothing about programming and are all shitt
>>
Lainchan is a bunch of tryhards
>>
>>54122815
Sadly there aren't that many gui-libs for python. but as long as ist's not too complex you can use tkinter
>>
File: piechart.webm (3 MB, 1920x1080) Image search: [Google]
piechart.webm
3 MB, 1920x1080
rate my piecharts. I use java and my own engine built on libgdx,
>>
>>54122865
>>54123212
Cheers m8s, I'll take a look at it
>>
>>54123249
needs more pajeets
>>
>>54123249
The pop out needs to be faster, get rid of the aliasing
>>
File: vive-lamour.jpg (533 KB, 1280x720) Image search: [Google]
vive-lamour.jpg
533 KB, 1280x720
Why don't people just use coffeescript instead of javascript?

Why don't people just write moonscript instead of lua?
>>
File: 1456561084453.webm (3 MB, 426x240) Image search: [Google]
1456561084453.webm
3 MB, 426x240
Ask your favorite programming literate anything.
>>
>>54123372
What is the best program to make that will have a high chance of me making a lot of money?
>>
>>54123372
give me a book on python3 that doesn't treats me like an idiot who never programmed before
>>
>>54123403
First, do you know how to program competently?
>>
>>54123324
it is faster but recording slows it down.

>get rid of the aliasing
I will. but I planning of writing a better shader but I really suck at that.
>>
I need to find a 1 second long sound effect in two hour audio recordings.
Where do I go to achieve this? Are there any libraries for that, like OpenCV for audio?
>>
>>54123372
Thoughts on F#?
>>
>>54123412
You're reading a python3 book, I don't think that exists. Figuring out the language should be self explanatory.
>>
>>54123403
A program that solves unsolved problems.

>>54123412
Maybe that's because that's why python is for babby's.

>>54123419
Looks pretty cool, but has no real-world uses, as with any other functional language.
>>
>>54123413
Yes I do

>>54123441
Such as what?
>>
>>54123417
There's no such tool... yet

Audio analysis is hard for a computer since it relies on fourier transforms and that's it.
>>
I finally mastered programming feels good


if( 2 % 0 == 0)
{
System.out.println("Even");
}
else
{
sout("Odd"); // Netbeans shortcut i'm lazy
}

>>
>>54123464
If you can't find an unsolved problem, just create a problem and its solution: write a virus.
>>
If i want to make desktop applications with decent UI on windows should i use WPF on VS?
>>
>>54123508
Nicememe
>>
>>54123510
Write a virus that only you can crack, then you come out with a solution and you get shitloads of bounty. Sounds like a movie
>>
>>54123487
That's a shame. Looks like it's hacking-shit-together time!
>>
So, this code works as intended except that, for some stupid reason, sscanf waits for a newline, even through it should be reading a null-terminated string. what the fuck?

    float n = -1;
char buff[128];
while(fgets(buff, sizeof(buff), stdin) != NULL && n < 0 ){
if(buff[0] == '\n'){
printf("[!] Please enter a positive float: ");
} else{
printf("%s",buff);
if(sscanf(buff, "%f", &n) < 0 || n < 0){
printf("[!] Please enter a positive float: ");
n = -1;
}
}
}
>>
>>54123651
You have to insert the '\0' at the end
>>
/dpt/ where do I look for jobs other than indeed?

I've kind of applied to every job there that I want and qualify for
>>
>>54123951
Create something that will generate income and employ yourself.
>>
>>54123965
I want an office with coworkers. I can't work without pressure
>>
>>54123983
The pressure will be looming homelessness.
>>
How many people in this thread actually use the software they've written on a daily basis? Like, actually useful software, not running your Enterprise Grade FizzBuzz once a day to affirm how great a programmer you are.
>>
WHY ARE ANDROID FRAGMENTS SO FUCKING SHIT, WHO WAS THE RETARD THAT CAME UP WITH THIS CRAP, GOD DAMN RETARD DESERVES TO GET SHOT
>>
>>54124003
I only write shit that I use
>>
>>54124008
I've been going through same struggle the past two days. Fragments are complicated but useful as fuck so you just have to push through it.
>>
>>54124037
>but useful
TABLETFAGS CAN GO FUCK THEMSELVES FOR ALL I CARE
>>
>>54124003
I made a borderless image viewer to replace the default windows one.
>>
>>54123249
Is that cursor from WarCraft 2?
>>
File: Untitled.png (819 KB, 840x924) Image search: [Google]
Untitled.png
819 KB, 840x924
>>54124003
I made two small progs that always run on my comp (cpu monitor, and network monitor), plus browser #113.
>>
>>54124003
Can't say I've come across a situation where a program that that I would need haven't already been written by better developers than me.
>>
>>54124065
What the fuck is that monstrosity.
>>
>>54124101
try it and see, if you're feeling brave enough.

4chan browser #112.

http://www.mediafire.com/download/sk04f0r92tk4bih/browser_112.zip
http://www38.zippyshare.com/v/rpiD9HOu/file.html
https://openload.co/f/0sczR9_i2g4/browser_112.zip
https://www.sendmyway.com/epobjnt58ka0
https://www.datafilehost.com/d/f13b286c
https://userscloud.com/mxzp5ln4h96l

pw: CRUISECONTROL
>>
>>54124123
Just put it on github or gitlab instead of that cancer.
>>
>>54124052
It's useful for easy transitioning between scenes.
>>
my daily fizzbuzz kata
(defun fizzbuzz (arg)
(interactive "P")
(defun fb (i)
(cond
((= (% i 15) 0) "FizzBuzz")
((= (% i 3) 0) "Fizz")
((= (% i 5) 0) "Buzz")
(t i)))
(dotimes (i (if (integerp arg) arg 100))
(insert (format "%s\n" (fb (+ i 1))))))
>>
>>54124123
Damn it's missing a glaringly obvious feature. In IDA pro you can mouse over a and see where it's been referenced. The little window pops up and you can use your scroll wheel to reveal more about the referenced text. I wish you could do that in this app.
>>
Is there a more elegant way to construct a list from the member variables of elements in a list than a for loop in java?

class Foo {
Bar bar;
Foobar foobar;
}

ArrayList<Foo> foos = ...
ArrayList<Bar> bars = new ArrayList<Bar>();
for (Foo foo : foos) {
bars.add(foo.bar);
}
>>
>>54124123
Why did you upload this garbage to 6 different hosts?
>>
>>54124123
Why not just use github and it's release page?
>>
Help please

I have these two, regPizza and specPizza in this class

I need to print them with System.out.println in another class but idk how

I tried System.out.println(regPizza) and System.out.println(Driver.regPizza) and some other stuff but really I just don't know what to do
>>
>>54124234
if you're talking about the quoted post numbers in comments then that may not be possible since there's not currently any way to interact with the thread preview window.
>>
>>54124325
What is toString()
>>
>>54123352

The problem with JavaScript is the type system, not the syntax. CoffeeScript just looks nicer. It fixes none of the problems with JavaScript.
>>
>>54124136
>>54124322
meh. too much work.

>>54124266
multiple redundancies, just in case some go down, or hit their free download limit.
>>
>>54124368
here is my toString, which is in a third class


im not sure if it works yet but I think so
>>
>>54124266
>>54124384
also, I used mirrorcreator.com, which makes it super easy to upload to 12 sites at once.
>>
>>54124384
I think you just don't know how to use git(hub).
>>54124394
Use toString() for each of the objects you want to print when you call them.
>>
>>54124254
ArrayList<Bar> bars = foos.stream().map(e -> e.bar).collect(Collectors.toList());
>>
>>54124422
>git

it's true. I've never used it, so I don't really need (or want) to know anything about it.
>>
>>54124422
>Use toString() for each of the objects you want to print when you call them.
w-what to do you mean

we didnt cover toStrings in class, the little I know about them is from google

if it matters,
Pizza is the class with the toString. the class I'm in right now is Order, the class with regPizza is a third class called Driver
>>
>>54124463
Do you know how to use any version control?
>>
>>54124506
not really, no. I'm too small time and amateur to be concerned with it.
>>
>>54124519
dude what the fuck is wrong with you, unless you're being a cuck about open source software
>>
>>54124501
I'm so confused at why you created two classes inside a class when you want to use them outside of the class. Regardless, to print an object you should call toString() on that object. If you want to print regPizza use regPizza.toString().

>>54124519
You should spend 5 minutes and learn to use Git and Github.
>>
>>54124519
>bundling only the .exe
I'm not going to bother unless it's on github or gitlab. Who the fuck do you think is going to run a binary uploaded to a shady download website and recommended by some faceless mook?
>>
>>54124519

Hi, Anon! Let me tell you why I've been using version control MUCH more frequently.

I used to avoid it too, thinking it was too complex to bother learning (it's not). Then I did this:

tar -cvf *.cpp *.h Makefile


And lost about an hour's worth of work (I had backups, but not of a lot of work I had done in that hour. Needless to say, I realized that not having a nice versioned backup is not a good idea.

Learn git. Or mercurial. Save yourself the trouble down the road.
>>
>>54124519
>get github desktop
>add your project folder
>add a readme.md
>type "first commit" in summary
>commit to master
>click publish

das it
>>
>>54124325
>>54124394
>>54124501
There is so much wrong with what you're doing. I'd like to help but I really don't wanna write a couple paragraphs on what you should've learned in your first week of class.
>>
>>54124056
That's kind of neat. Can it view animated gifs?
>>
>using github
>not running your own git server in your home network

Are you faggots stupid or something? Who would willingly publish his own code?
>>
>>54124600
>Who the fuck do you think is going to run a binary
idk, but people apparently do. I think they're stupid to do so, but it's their choice. I didn't make browser for them anyway - I made it for me. so if no one else uses it, I don't give a damn.

>>54124604
I make copies of the files all the time, and have at least four backups on various drives and servers. I rarely need them though.
>>
File: Screenshot_2016-04-19-23-08-17.png (28 KB, 380x588) Image search: [Google]
Screenshot_2016-04-19-23-08-17.png
28 KB, 380x588
I'm having some trouble styling css. How the hell do I get my buttons to center align? Everything I read saying to do margin: auto or position: absolute but all that does it put all the buttons on top of each other. What do I need to add?
.button {
background-color: #707070;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
>>
File: Bait - Warhammer 40k.jpg (60 KB, 680x649) Image search: [Google]
Bait - Warhammer 40k.jpg
60 KB, 680x649
>>54124666
>I think they're stupid to do so, but it's their choice.
Then why the fuck are you advertising your binary-only links? It's time to stop posting, Satan.
>>
>>54124662
The anon in question isn't using git at all.
>>54124666
ANY version control would make that process so much simpler. You'd also learn a tool crucial to working with anyone ever.
>>
>>54124619
>github desktop
what's that, a program I would need to constantly run on my comp? screw that.
>>
>>54124719
well in this instance, someone asked what it was (as if the screenshot wasn't enough), so I posted a link. I actually do try to avoid spamming my hobby project.

>>54124722
>working with others
NO THANK YOU. that sounds like pure hell to me. a true craftsman works alone anyway. ;^)
>>
>>54124672
Try
margin: 0 auto;
? usually that works for me. It also depends on whether or not the parent has a set size I believe.
>>
>>54124783
I'll give it a go. This it he styling for the div the buttons are in
.center {
margin: auto;
width: 60%;
border: 3px solid #D0D0D0;
padding: 10px;
}
>>
File: chrome style inspector.png (35 KB, 555x323) Image search: [Google]
chrome style inspector.png
35 KB, 555x323
>>54124795
Also when in doubt, pic is your best friend.
>>
>>54124003
I write hack scripts to automate my shit at work, saves tons of time
>>
>>54124672
>>
>>54124835
>>54124837
Thanks dudes.
>>
Made a little demonstration of diffie-hellman key exchange. Only problem is that now I have the key I'm not sure how to go about applying it easily.

What's a super simple symmetric encryption algorithm for single lines of text?
>>
>>54124836
I want to do this but I am shit with python. Where to get started? How should i practice regular expressions?
>>
Working on a NodeJS clone of Kahoot for shits and giggles, also fooling around with opencv.
>>
>>54124765

Working for companies on a contract pays more than working freelance (usually). Doing so usually requires working with others.
>>
>>54124949
I have no intention on ever having a programming job. it's strictly a hobby, and I'm my own boss.
>>
>>54124835
don't use -webkit stuff, no one should actually write that. have something do that for you

use http://bourbon.io/docs/#margin instead
>>
>>54124969

>I'm my own boss
This puts you in charge of figuring out what the hell people want to buy. If you work for a large company, that job gets delegated to the marketing department and such.
>>
>>54125006
Look at his project
>>54124065
>>
>>54124642

its ok i figured it out
>>
>>54125033

Would anyone actually buy that?
>>
>>54125006
I don't sell anything I program. I'm not in it for the money.
>>
>>54125050
you full well know the answer to that
>>
>>54124942
I am also trying to get into OpenCV. What specific stuff do you want to do with it?
>>
>>54124981
It's just a screenshot of this thread's source. Chill bro.
>>
>>54125053

Fair enough. But since you are your own boss, how do you pay the bills?
>>
>>54125079
eh, how I pay the bills is irrelevant.
the point is, it's a waste of my time to use git and to learn to code with others. the day I do that is the day I stop coding.
>>
>>54124875
rot26
>>
>>54125102

Meh. I enjoy programming on my own, but I'd also like to be able to put food on the table. I'm pretty much planning on working at a company like Microsoft after I've graduated with my masters.
>>
>>54125145
that's great. I wish you luck.
I would never want to work for MS or any tech company, or to get a masters, or to be a doctor, or do anything that requires a large amount of work and stress. you wanna make the big bucks? go for it. I do not envy that life.
>>
>>54125143
Well hot damn anon I'll never be able to decrypt that
>>
File: test.png (12 KB, 612x367) Image search: [Google]
test.png
12 KB, 612x367
say you have pic related. all the tiles and the red and blue rectangles are sorted by their y axis (higher y value = draw first, lower y value = draw last). then all the tiles and rectangles are sorted by their layer (lower layer = draw first, higher layer = draw last). the blue rectangle is on a lower layer than the red one even though the red rectangle is 'behind' the blue one. how do you fix this
>>
>>54125167

Meh, to each his own. Less competition for me.
>>
This is Python code to test whether a 3D vector is diagonal. Sorry for the shitty coding; I'm not totally sure my logic is right/most efficient, but this is purely a functionality/compiling question.
def is_vec_diagonal(vec):
if vec[0] != 0:
if abs(vec[1]) + abs(vec[2]) == 0:
return False
else:
return True
elif vec[1] != 0:
if vec[2] == 0:
return False
else:
return True
return False

def is_vec_diagonal2(vec):
if vec[0] != 0:
#this can only be 0 if both axes are 0
return abs(vec[1]) + abs(vec[2]) > 0
elif vec[1] != 0:
#we know the X coordinate is 0 already from the previous statement,
#so if the Y coordinate isn't 0 then the we can simply test Z directly
return 1*vec[2]
#if both X and Y are 0 it's not diagonal
return 0


Is one function going to be faster than the other? If so, which? 2 is certainly shorter, but I know that's not necessarily related. Would they actually compile to equivalent code(or, assuming my code isn't optimal in both cases, if done correctly would they?)?
>>
>press ctrl+alt+printscrn
>release printscrn while keeping ctrl+alt pressed
>press i and release it while keeping ctrl+alt pressed
>???
>SHIT BRIX!
>>
>>54125345
DON'T DO IT GUYS! IT MAKES MUSTARD GAS!
>>
There's a program written in Qt, is there a way to extract its QRC files, adjust them, and archive them back into the application?
>>
Can I write a program whose binary executable is coherent reading material?

I want my exe to be an quote from stallman...
>>
>>54125329
Also, I realize that I could condense it even further:
def is_vec_diagonal3(vec):
return (vec[1] != 0)*(1*vec[2])*(vec[0] != 0)

Would something like this(it may be incorrect but I whipped it up simply to show as an example; at the very least, I ran a quick test on it and it produced correct results) be the fastest?

I guess the big question here is, am I benefitting by avoiding the if statements and directly using arithmetic instead?
>>
>>54125329
What are the properties of diagonal 3D vectors compared to regular 3D vectors?
>>
>>54125235
Layer based on depth from screen, or as I like to call it, glEnable(GL_DEPTH_TEST);

No reason to create a layering system on top of another.
>>
Hey /dpt/, I'm trying to make a 4chan thread downloader extension for chrome. I can't figure out how to open a URL in the way one would open a file (I.e. open a thread's json object to parse it). Everywhere I look I see ways to open new windows or tabs, but nothing on how to open things in the background without the user seeing new shit pop up then disappear. I'm a C programmer and find JavaScript different and therefore wrong. Can somebody help?
>>
>>54125345
doesn't that Magic SysRq key?
>>
>>54125452
Just use wget you stupid fucking faggot.
>>
What's the benefit of using a property in place or a variable when you're using uncustomized getter/setters?

So you know what I mean:


class car {
public string Make { get; set; }
}



vs.

class Car {
public string make;
}
>>
>>54125472
How do I do that with JavaScript
>>
>>54125469
It's the magic sysreq which terminates all processes except init.
>>
>>54125474
For when you realize that you actually needed some sort of logic in the setter and have to go and change 2,000 instances of accessing the public field.
>>
>>54125428
Is this a rhetorical question?
I'm not smart enough for a definition with any kind of rigor, but using the idea of space I'm working with, a vector would be diagonal if it has nonzero values on more than one axis. For example, [.252,.652,0] and [1,1,1] are diagonal, but [1,0,0] and [0,.36,0] are not.
A zero vector(0,0,0) would not be a diagonal, but that would probably be tested for somewhere else.

I probably should have wrote that but I'm scared of making walls of text.
>>
>>54124003
python scripts to manage my special snowflake todo-list system. that's about it.
>>
>>54125504

So is it generally recommended to always use properties instead of class variables?
>>
File: my homework.jpg (219 KB, 1461x1016) Image search: [Google]
my homework.jpg
219 KB, 1461x1016
so does /g/ want to do my homework?
>>
>>54125531
No
>>
>>54125546
is it because you dont know how to?
because i dont too
>>
>>54124003
As someone who works with graphics software a lot, I use what I program almost every single day, many times a day. That being said I'm nor far past a scripting level.

>>54124066
This is sometimes true for me too, but there are plenty of features in almost any 3d application which no one has done yet, or ways to easily improve upon existing ones. For example, in Blender, there's no easy way to transfer one object's shape key to another if their vertex count AND order isn't EXACTLY the same.
>>
>>54125509
It was serious question. I couldn't google the definition.

There're only 3 cases:
def is_vec_diagonal(vec):
return (vec[0] != 0 and vec[1] != 0) or (vec[0] != 0 and vec[2] != 0) or (vec[1] != 0 and vec[2] != 0)
>>
>>54125560
Thanks for the working code, but I mainly posted because I was interested in the question of which approach is faster. Is it actually faster post-compilation to condense code like that and avoid if structures, or does using if statements produce equivalent/comparable code?

It may not seem that important but when you're analyzing millions of vertices I think considerations like this become significant.
>>
>>54125404

If you want it to be an exe, you can't make it readable. At least not all of it. You could pull off a cheap hack like the .NET runtime does though, by placing the entry point to the program in an external DLL and embedding your bytecode (or plaintext script in your case) in some sort of rodata section. That would render all but the header as human readable.
>>
>>54125616
What is posted is crystal clear check for the properties you metnioned (it's even disjunctive normal form). One can easily deduce it by just looking at the code.

Your code is crap erroneous filled with branches. In one branch you return boolean and in second you return float. It's pointless to reason about performance of invalid code.
>>
>>54125560
>>54125616
To be a little more clear, I'm also thinking this because if the code produced by an if statement sequence IS different, then for example, say 40% of the vertices you're analyzing using this function satisfy the first if statement.

Using if logic, that means the function completes on the first if step and no further calculations are necessary for 40% of the vertices it's run on.
Using a condensed equation, the function has to do the entire calculation for every vertex... right? Or am I mistaken?

Wouldn't this mean the if statement approach, and possibly as many branches as possible, could be significantly faster when the size of the set you're analyzing is very large? Or does the speed lost by using if structures(?) make the condensed form equivalent in speed/better(assuming the compiled code is actually different)?
>>
>>54125677
Alright, I didn't mean to offend you and I certainly wasn't questioning your code, nor did I ever say my own code was good or valid. Regardless, thanks for responding, I guess. Take it easy.
>>
>>54125701
>>54125760
I'm cool bro. I think that multiplying floats isn't exactly a cheap operation and I don't think you'll outsmart the compiler in this case (as opposed to integer tricks). If you're not sure, just stick to clear baby code.
>>
>>54125531
>char s*1
>const char *s2

Why is it that i always see this common shit in c++? Why is referencing memory pointers as a shortcut even useful?

Just fucking program the simple way. Theres no need for that trash.
>>
>>54125760
>>54125809
> Great programmers write baby code
-- Erik Meijer
>>
>>54125827
What the fuck are you talking about?
>>
>>54125827
strings are char pointers, and pointers are pass-by-reference instead of pass-by-value.

Learn to fucking program
>>
>>54125927
>pointers are pass-by-reference instead of pass-by-value
>>
>>54125809

>I think that multiplying floats isn't exactly a cheap operation.
So... Intel has this big ass manual with instruction timings for all of their CPUs. I don't have it on me, but last I checked, multiplication isn't that much more expensive compared to addition and such. Plus, you can compute multiple floating point multiplication operations simultaneously.
>>
>>54125938

Well, it's not really a shitstorm when everything is obviously pass-by-value.
>>
>>54125329
You could just write

def is_vec_diagonal(vec):
return ((vec[0] != 0) ^ (vec[1] != 0) ^ (vec[2] != 0)) & !((vec[0] != 0) & (vec[1] != 0) & (vec[2] != 0))
>>
>>54125329
oh wait, I meant

def is_vec_diagonal(vec):
return !((vec[0] != 0) ^ (vec[1] != 0) ^ (vec[2] != 0)) & !((vec[0] != 0) & (vec[1] != 0) & (vec[2] != 0))

that first exclamation point makes all the difference
>>
Has any Android developer here worked with StorIO?
>>
>>54124731
No. There's this new thing called servers where files get stored, y'know? Github Desktop is just a convenient front end to push commits.
>>
I need a posix nerd. Someone tell me if getpid always return a nonzero value
>>
>>54126229
At least on Linux, yes.
I do remember using Minix in university and it having pids <= 0 for system crap, but any realistic user program can expect a pid > 1.
>>
>>54126130
I never got the frontends for version control. command line is just as good and you'll need to learn it anyways if you want to automate version control tasks.
>>
>>54125616
desu the dark arts of optimization have been mostly lost to the sands of time. you'll get the best answer, which is likely dependent on platform and actual input, with profiling
>>
How can I create an array of one classes within a linked list of another set of classes which the size fluctuates. I keep getting "std::bad alloc" errors. I really don't want to use another set of linked list.
>>
>>54126524
You want a linked list of arrays? I assume since you ask you can't use the array type, but can you use the array class?
>>
>>54126594
I probably wasn't clear in my first post, but I have class, that I fill by reading from an ifstream. So I use a linked list to combine all of them, but within that class I need to create array of a smaller class, which I also read from the file.
>>
set up a [spoiler] windows [/spoiler] server for fun
what should i use it for?
>>
>>54126641
still not sure what you mean. Are you having trouble parsing the stream, or creating the array?
>>
File: hr.png (15 KB, 420x504) Image search: [Google]
hr.png
15 KB, 420x504
HackerRank at it again
>>
>>54126697
you have an extra space in every row you shitter
>>
File: drop_shadows_background.png (689 KB, 1600x888) Image search: [Google]
drop_shadows_background.png
689 KB, 1600x888
A daily reminder that machine learning >>> ordinary programming
>>
>>54126691
Creating the array within the class, because I dont know what the size will be, as its determined by what I read from the infile. I get the "std::bad_alloc" error, so I guess I'm using too much memory.
>>
>>54126709
>feeding structured data into a library
>programing
>>
>>54126709
>all the examples are in python
must be some really challenging stuff anon
>>
>>54126709
>using scikit
lmao
>statistics is programming
doublemao
>>
>>54126730
do you have to use an array? Array sizes are don't change. At best you could use realloc() every time you read in a new element, which makes parsing an O(n log n) operation, which is pretty shitty compared to just using another type of list
>>
File: sad yui3.jpg (44 KB, 500x495) Image search: [Google]
sad yui3.jpg
44 KB, 500x495
>open algorithms textbook
>turn to section on binary search trees
>1 page dedicated to psuedocode and describing their use cases
>20 pages of idioglossia and mathematical proofs that binary trees run in linear time in worst case
I mean, who the fuck cares if they run in O(n) time, the book even expects me to import the standard C++ implementation instead of writing one myself so i don't learn anything.

Maybe CS just isn't for me?
>>
>>54126919
>>>/india/
>>
File: 1457880078810.jpg (54 KB, 800x800) Image search: [Google]
1457880078810.jpg
54 KB, 800x800
I'm writing a fucking website. I'm always writing a fucking website. How the fuck did I end up like this? I had goals anon.
>>
>>54126886
No, I tried a using vectors, and then resizing and pushing back each element, but I get the error. Should I just do another linked list within the one I already created?
>>
>>54126919
CS is just applied math, senpai.
>>
File: _.jpg (215 KB, 744x1555) Image search: [Google]
_.jpg
215 KB, 744x1555
>>54126919

Fairly typical.
>>
>>54126967
you need to increase you memory allocation limit.

Maybe making it a global variable would help? I don't know how to do it on the system-end
>>
>>54126919
Fuck I've been looking for a language with raw balanced BST implementations in the standard library. C++ isnt one of them.

I just need raw access to the tree structure to implement a quick and dirty range tree (so I need to be able to traverse the tree manually and add metadata to the nodes).

Does no language have native red-black BST trees or similar? It's a god damned bitch to implement manually with all the balancing edge cases if I just want to use it for a quick and dirty problem. I mean it seems like a pretty standard data structure...
>>
>>54127011
Fuck, I've seen this proof somewhere. In math stat I think.
>>
>>54127017
That's probably past the scope of this class, it really shouldn't be this hard. There at most 99 arrays/vectors/list or whatever that need to be created. Each set of data is linked to a larger class, so I'll probably just try to do a linked list within the one I already created. I'm probably gonna fail, but thanks for the help.
>>
>>54125405
if (abs(vec) == 0):
return false
else:
normalized = { vec[0]/abs(vec), vec[1]/abs(vec), vec[2]/abs(vec) };
return ((normalized[0] + normalized[1] + normalized[2]) == 1);

>>
>>54127153
abs(normalized[0] + normalized[1] + normalized[2])) == 1*
>>
>>54127173

Does anyone have a good link to describing how to create read and write to a text file in C#? MSDN doesn't really describe anything, there's just dozens of code examples using Files, FileStreams, WriteStreams etc. but no explanation of what/why they're doing it. I'm a beginner obviously.
>>
>>54127233

File.ReadAllLines & File.WriteAllLines
>>
>>54127050
pls respond
>>
>>54127255
Judy array ;)
>>
>>54126709

Meh. About half my university's CS department is really into machine learning stuff, but personally, after a couple of classes on natural language processing and artificial intelligence and such, I actually find it a bit boring.

>>54127050

C++'s std::set I think is typically implemented using a balanced binary tree, but there is no standard way of accessing the raw tree structure.
>>
Can you call a classes private methods in it's constructor? C# to be specific.
>>
>>54127409
yea
>>
Tried to get the sliding piece move generator working today. Proved to be more difficult that I thought so I spent my time adding support for more compilers and arranging my terminal layout instead.
>>
>>54121524

A continuous integration in GoLang and Bash implementing Docker, for git.
>>
>>54121855
C

>>54121863
>Java
topcake
>>
getting unexpected compiler error. g++, trying to compile something like this:

class A {
virtual void foo() = 0;
};

class B {
void foo() override;
};

inline B::foo() {
.... //one line of code in this function
}


g++ is saying "extra qualification 'B::' on member 'foo' [-fpermissive]

"void 'B::foo()' cannot be overloaded with 'void B::foo()'"

wtf? I tried putting the "override" term after the inline function declaration as well to no avail. This was all working/compiling until I altered something in this class that had nothing to do with this function.
>>
yo /g/, why is this getting caught in the while loop whenever I insert more than one value into the list

struct node* temp = &Dictionary[index1];
while(temp->next != NULL){
temp = temp->next;

}

struct node a;
a.vertex = vert2;
a.next = NULL;

temp->next = &a;
>>
>>54127816
Not sure what the problem is, but inlining virtual functions is tricky and doesn't always work.
>>
>>54127816
nevermind my make file sucked. occurred to me that was the issue as soon as I posted this after doing dumb tinkering for 20 minutes...
>>
File: 1374004101205.gif (1022 KB, 297x190) Image search: [Google]
1374004101205.gif
1022 KB, 297x190
Why is debugging low level multi-threaded code so difficult?

Am I just retarded?
>>
>>54127865
>inlining virtual functions is tricky and doesn't always work.
It's either virtual or inline, you can't have it both ways.
>>
>>54127912
you forgot to make everything immutable
>>
>>54127912
>Am I just retarded?
probably.

I debug low level multi-threaded code before breakfast while I still have a massive hangover.
>>
>>54127836
Okay, I fixed it, just had to replace
struct node a

with
struct node* a = (struct node*)malloc(sizeof(struct node));
>>
>>54127942
I'm working on a really old codebase, that would take years

>>54127962
Could you give me any tips? I sometimes spend a half hour in gdb before realizing that I accidentally unlocked a mutex in the wrong place
>>
>>54127987
meant to quote >>54127944
>>
File: meh.ro4955.jpg (101 KB, 800x585) Image search: [Google]
meh.ro4955.jpg
101 KB, 800x585
/dpt/ I don't mean to be a meme, but basically, I'm someone who has some money around $10-$20 thousand, and I'm looking to hire a guy or two to develop an android game. Not looking to spend more than that.

Basically a base building/tower defense kind of deal, rather generic, graphics would have to be original but code can be borrowed from anywhere whatever makes it work. Needs to look real nice and shiny. Would probably be a one dollar app with in app purchases as well, but bonus style not freemium style in app purchases.

I'm real worried about getting fucked. I have one friend who knows what he's doing and has offered to review the program for me a bit to make sure I'm not getting fucked, but I have no idea. Where do I get a guy for this? Stack overflow seems to be for long term positions with established companies.

Maybe I can make a thread about it here?
>>
File: 1447694792441.jpg (104 KB, 800x797) Image search: [Google]
1447694792441.jpg
104 KB, 800x797
>>54128011
>unironically wanting to spend at least $10K on a crappy app

just drop that cash in an exchange fund, it'll serve you better there.

the android gold rush died years ago, it is almost guaranteed that you won't make your investment back if you do something like that today.
>>
In C, how do I write my vector and hashmap implementations generically?

Is it possible to do something like
#define vector_init(T) \
void vector_init(vector_t *self, unsigned size) \
{ \
self->arr = (T *) malloc(sizeof(T) * size); \
...
>>
>>54128011
I'm going to preface this, I have no idea what goes into making a game, but just off the bat seems like a terrible idea.

Why would you want to do that? You think it might be a good investment? This really reminds of me this article about an interview with someone that worked on action 52 I read once.
Thread replies: 255
Thread images: 36

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.