[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: 48
File: 13_vector_calculus-199.gif (4 KB, 363x136) Image search: [Google]
13_vector_calculus-199.gif
4 KB, 363x136
CS is a subset of math edition

Old: >>55516010
>>
>>55525500
Making a game and playing a game are two very different things you know. The possibilities when making a game are literally boundless.
>>
>>55525463
Stop making threads before the bump limit please.
>>
>>55525527
>The possibilities when making a game are literally boundless
so they are when making any computer program, lol
>>
>>55525527
Also why make a game when it's probably going to be shit anyways, instead of just program something applying to real world problems instead of wasting time on developing the game.
>>
>>55525599
Because one person can make a small game, whereas the smallest real-world problem requires a team of programmers.
>>
>>55525599
I can take your logic and apply it in reverse. Why program a real world application when everybody has already done it better. Might as well make a game because it will be fun to make and at the very least may be fun to play even if it isn't very creative or new.

Why make anything for literally any reason when it might be shit.
>>
Would this be the right thread for mysql questions?
>>
>>55525463
Jack Stouffer, I know you browse here
>>
>>55525640
if it's very simple go to /sqt/

if it's actually interesting and you have done proper research then ask here
>>
>>55525621
> the smallest real-world problem requires a team of programmers
make a program to convert the output of for example 'objdump -d [whatever]' into a more readable form.... you don't need a team for this, still it's a real world problem
>>
File: gnome_vs_kde.jpg (17 KB, 600x225) Image search: [Google]
gnome_vs_kde.jpg
17 KB, 600x225
IT is the greatest thing ever. You literally work 1 hour a day and get 100k a year.

Also, I'm glad we all agree that KDE > Gnome.
>>
>>55525667
> using a DE
>>
>>55525667
>Also, I'm glad we all agree that KDE > Gnome.

LXDE is better than both.
>>
>>55525692
>>55525696
>Answering to an obvious bait.
>>
>>55525667
>>55525696
All shit
>>
>>55525667
>>55525692
>>55525696
>>55525706
>>55525707
i3 m80s
>>
>>55525493
it'll take a new person way to long to get anything done
I've been programming for 15 years and I wouldn't program in raw opengl
it's just a waste of time for any hobby programmer
>>
>>55525706
bait? KDE is way better than Gnome, still why would you even use a DE, it's just a waste of memory
>>
>>55525734
>it's just a waste of memory

Unused memory is wasted memory.
>>
>>55525630
My thinking as well. If you make a game then it's at least original in some sense. Even if it is highly derivative, nobody really cares.

With a useful application, first you have to start with research. Find the company that's already done that program, and then after that there's no legitimate reason to duplicate that effort.
>>
>>55525696
>LXDE
>not LXQt
>says the C# anarcho-statist-christian-libertarian-capitalist-militarist
>>
>>55525728
I completely believe you have been programming for 15 years and would dissuade people from programming in OpenGL. Clearly you are on the up and up.
>>
>>55525739
>Using 100 of memory at all times
>>
Any Android developer lurking here?
>>
>>55525761
great, I'm glad we settled that, then.
>>
>>55525463
why do i even NEED math when i just want to make games?
>>
>>55525768
If there are they probably won't respond to you due to captcha.
>>
>>55525768
> android dev
> java code monkey
lmftfy
>>
>>55525782
You're right, text-based games are always an option.
>>
>>55525784
Ok...
>>
>>55525745

I don't have to like Qt, do I?
>>
>>55525810
Or you just use Unity
>>
Is PySide / PyQt the best GUI library for Python despite being so unpythonic?

Should I when writing a PySide program follow Qt conventions or should I follow PEP8, and make exceptions whenever I need to call a Qt method?
>>
>>55525900
Unity is for shitdevs.

Also fucking John Riccitiello is the CEO of Unity.
>>
>>55525878
Qt is the anti-capitalist UI for the masses, so yes, you DO have to love it, or you get sent to the gulags, fucking capitalist pig
>>
File: example.png (38 KB, 771x489) Image search: [Google]
example.png
38 KB, 771x489
>>55525659
I've spent a couple hours searching through docs and Google searches without any results. Is there a quick and easy way for humans to enter into a mysql database? I'm not just talking about things like PHPMyAdmin or MySQL Workbench, I've already got both of those running and I can't find the feature I'm looking for.

Let's use product orders as an example.
>Bob buys 200 foobars
How would I add this without either memorizing the customer_id for Bob as well as the product_id for foobars or needing to look them up every time?

Is there an easy way to do this or do I have to program something from the ground up?
>>
File: required reading for (You).png (381 KB, 528x528) Image search: [Google]
required reading for (You).png
381 KB, 528x528
>4chan
>36 posts and no anime
Fucking summerfags
>>
>>55526050
suigin?
>>
>>55525667
> KDE>Gnome
>both of them are not Unity
why even compare them?
:^)
>>
File: What Remainiacs See.jpg (240 KB, 594x558) Image search: [Google]
What Remainiacs See.jpg
240 KB, 594x558
>>55525975
>gulags

Not anymore.
>>
File: sicp.png (297 KB, 640x480) Image search: [Google]
sicp.png
297 KB, 640x480
>>55526050
>>
Is Haskell the comfiest language?
>>
>>55526315
super comfy
even refactoring is comfy
>>
>>55525995
To insert the values into the table you can do something like
insert into orders(primary_arbitrary_key, order_number, product_id, customer_id)
select **arbitrary_key_value**, **order_number_value**, prod.product_id, cust.customer_id
from (
select product_id
from products
where product_name = 'foobar'
) as cust,
(
select customer_id
from customers
where customer_name = 'Bob"
) as prod


The problem here isn't whether you select the values every time or compute it beforehand, at least for a simple schema like this. The Optimizers are quite good and can produce good running times if the logic in the provided qurey isn't weird or extreme. The problem is that there is no way in the provided schema to store the information about the amount of products in the order. there is only the 'kind' of the products in the order
>>
>>55525949
>not using a tool because of some no-doubt petty grudge against the tool's developer
>>
>>55526352
* Correcting myself, I'm too tired for this shit
as prod
in the first
and
as cust
in the second inner select
>>
Well I learned to use Git today, now I'm pushing my shitty attempts at CS50's psets to github.
I feel like a pro, man.
>>
https://www.reddit.com/r/programming/comments/4s6qth/the_rustonomicon_the_dark_arts_of_advanced_and/d573ta6

which one of you is this?
>>
>>55526513
>Screw you, mozilla and rust are run by the ideological equivalent of struggle-session tier red guards and you fucking know it. I'll never understand why these pathetic SJWs felt the need to attach a shitty programming language to their propaganda campaign, but there it is.

Word
>>
>>55526352
>The problem is that there is no way in the provided schema to store the information about the amount of products in the order. there is only the 'kind' of the products in the order
Sorry, I whipped it together in 5 minutes as an example.

>The problem here isn't whether you select the values every time or compute it beforehand, at least for a simple schema like this. The Optimizers are quite good and can produce good running times if the logic in the provided qurey isn't weird or extreme.
The compute time isn't what I'm concerned about, it's the time it would take a human being to enter each order. Needing to type out 12 lines for every order is kind of time prohibitive.

tl;dr: Is there an already existing feature or program to automatically turn "Bob" and "foobar" into their correct id's and enter them on the correct table, or do I need to write something from the ground up?
>>
File: rust.jpg (46 KB, 1280x720) Image search: [Google]
rust.jpg
46 KB, 1280x720
>>55526513
>rust
>>
>>55526649
Is that a girl?
>>
>>55526355
that's the most used """"""""""logical argument"""""""""" you'll find in 4chan.
it's ironic that these people call themselves """"""""""programmers"""""""""". it's as if they weren't taught some basic logic or something
>>
>>55526355
>Petty
>The guy who cranked EA's Jew mode up to levels previously thought impossible
>>
>>55526657
What the fuck did you just say?
Fucking ultra privileged cis-gendered fascist
does everyone have to conform to your fucking gender ideals or what? Get the fuck over yourself sexist pig.
>>
>>55526679
Fuck off. John Riccitiello has a verified history of launching shill campaigns on 4chan.

Unity is shit. It doesn't even support C++.
>>
>>55526719
Never fucking reply to me again unless you're contributing to the thread.
>>
>>55526798
Fuck off kike.
>>
>>55526696
>>>/v/
>>
>>55526925
>>>/r/unity
>>
>>55526924
Fuck off commie.
>>
>>55526657
Pretty sure that's the main guy behind Rust.
>>
>>55526577
If you are talking about having a way for goons to enter data into your db, just make a gui in visual basic with a data grid and auto-completion on the data-entry and you're golden. That way, they can't fuck up the foreign keys. Alternatively, if you want it on the web make something similar in your favorite hipster webdev language of the month.

It shouldn't take you more than a day!
>>
File: 12342134.jpg (46 KB, 850x400) Image search: [Google]
12342134.jpg
46 KB, 850x400
>>55525463
Math people is horrible doing programmin
>>
What are the operators I need to overload in order to use a type as a key in an std::map?
>>
>>55527083
operator < so they can be in some order
>>
>>55527083
<
==
>>
So, I am trying to model a DB for a Shop. It's nothing too complex, I just wanted to keep track of the shop's inventory and sold items.
So far, I got picture related but I am worried about the "Quantity" field in my "Item Table. Will it be enough to keep track of both the quantity of each item sold in a sale and in the shop's inventory or should I add an "Inventory" table?
Tips are welcome.
>>
>>55527103
>>55527107
Thanks
>>
>>55527038
I know it's shitposting, but I had the opposite experience with a few mathfags. One of them was double majoring with CS and was really, really good. The other two still did great despite one being in statistics and the other on pure maths. Goddammit mathfags, join CS, it's basically applied math.
>>
>>55527127
>implying maths isn't applied programming
>>
>>55527119
what tool is that in the pic you posted?
>>
>>55527083
you don't need to overload anything, you specify it in the template
>>
>>55527142
http://ondras.zarovi.cz/sql/demo/
>>
How do I compile a C program using CC-mode in emacs? I'm just starting to program and read the intro in enacs
>>
>>55527193
Teko a cute. Why not use the terminal and gcc?
>>
>>55527175
Not true.

If you have your own type as a key it should overload some operators so that the map can keep track of it.
>>
How can I program computers?
>>
File: amanchu_pikari_face.webm (842 KB, 1080x720) Image search: [Google]
amanchu_pikari_face.webm
842 KB, 1080x720
>>55527228
Mainly because I'd like to use emacs more and learn it better. But using GCC works too.
>>
How do I get rid of dll dependencies? I'm sick of my program folders being filled with shitty dlls.

Alternatively how I access those dlls from a sub folder.
>>
File: 1466969439647.png (695 KB, 782x1080) Image search: [Google]
1466969439647.png
695 KB, 782x1080
>>55527258
>>
>>55527265
what are you using? eclipse? Qt creator ? Visual studio??
>>
>>55527300
g++
>>
>>55527119
https://www.youtube.com/watch?v=0waQT2A17aI
Random shitty youtube video that explains your extended problem.
You need to design and normalize your db correctly.
>>
In C++, how can I cast something to my own type?

I want to cast an SDL_Point (just an X and Y) to my own type with some other stuff, all I can find is how to cast to something else from a my own type.
>>
>>55527497
http://en.cppreference.com/w/cpp/language/converting_constructor
>>
Can SQL Server be run on non-Windows hosts yet?
>>
>>55527497
You could always inherit from SDL_Point, add the functionality you need, and whenever a native SDL function requires it, your type will work as well.
>>
In terms of language design, what would you consider "essential" abstract data types? I'm thinking of dictionaries (cover the same uses as arrays and dictionaries), immutable directed acyclic graphs (cover the same uses as (linked) lists and trees) and sets. What else would you include?
>>
I want to write an emulator, I've already written a CHIP 8 emulator what should I do next?
>>
>>55525463
>Green theorem
just use Stokes nigga.
>>
does this work in c++
for (int i=0, i<5;i++)
int y =i;

Im in a bit of a predicament where I need to set a bitset for each i but it seems you can only call the constructor on the bitset.
I really dont want to deal with new/delete.
>>
So it it generally agreed that the length of a variable name should grow with it's scope?

eg. loop counters being 1 char and global constants being THIS_FUCKING_LONG.
>>
>|=
what is this supposed to mean. cant even google it.
>>
>>55527960
1) Unit type, empty type
2) Sum type, product type
3) Inductive types or some form of Fix type

Fix f = f (Fix f)

>>55528076
x |= y
x = x | y
>>
>>55527727
Didn't even think of that, thanks.
>>
Hey, basic programming question, I'd appreciate if someone could help me out.

in C# and XNA,

Maybe I'm just dumb.

I have a class called Paddle, which I use to generate an object called paddle.

I have another class called Ball. I want a function in ball that puts the location at the middle of the paddle. I can't use the object paddle to reference it though (to find where the paddle is on the screen). Why not? It says "paddle does not exist in this current context", so how do I pass the information to the class?
>>
Maybe someone doesn't mind sharing any info they have about this particular question, and maybe it's a dumb question, but I am trying to write a simple text compression program in java. Yes, I know this is completely pointless from the standpoint that there are a thousand programs that will do this, but I'm sort of just trying to brush up on my programming in general, so bear with me.

I'm familiar the math behind David Huffman's algorithm. I can compute the frequencies of the characters in the source alphabet, and am using a priority queue to generate the binary representation of each character based on it's relative frequency. Here is my possible stupid question: how do you output the 1's and 0's as single bits?
>>
>>55527141
I learned Lambda calculus without realizing that I learned it. It's basically functional programming using only mathematical expressions.

Seriously, if you know functional programming, read this: https://en.wikipedia.org/wiki/Lambda_calculus#Informal_description

It practically blew because the word "calculus" scares me and I already knew everything there.

>>55526798
Hi. Can you get mad at me too?
>>
>>55528369
The difference between programming and maths is vague and calling one "applied <other>" is silly
>>
>>55528417
Strictly speaking, it programming is all just abstracted binary math...

But yeah, that's a stretch from the things that most programmers actually do. Also, math itself can be "applied math" when it is used for something.
>>
File: frodo.png (214 KB, 400x399) Image search: [Google]
frodo.png
214 KB, 400x399
Will we ever make a computer that's better than humans at making chess computers that are better than humans?
>>
>>55528469
The people who gave birth to the chess computer programmers have already done so
>>
File: 1456631892924.jpg (118 KB, 467x349) Image search: [Google]
1456631892924.jpg
118 KB, 467x349
Sup /g/ents
I'm an aspiring software developer who works in numerous languages and formats. How can I break into professional work? I've considered freelancing but there's so much competition on those websites you can never get anywhere unless you already have 500+ positive feedback. I know I'm talented but have no way to apply it or demonstrate it to somebody.

What do I do? I have some solid resume material, like an internship at a major tech company where I did development for enterprise-level servers and automation software, but that only gets me so far.
>>
>>55528469
>will programmers ever cuck themselves out of their livelihood?

Some poor stupid autist is going to fuck it up for everyone and it's going to happen in your lifetime.
>>
>>55528494
I got a long term client the first day I started looking on elance (now upwork)
I didn't put any work history or even a picture in my profile.
all you have to do is write a non-copy-pasted application to their job posting
>>
>>55528494

the company you did an internship with has no interest in interviewing you?
>>
File: heh.jpg (36 KB, 400x460) Image search: [Google]
heh.jpg
36 KB, 400x460
>>55526798
unity does nothing but teach wannabe game devs bad habits in programming. i mean ifs it even supports js. and the mlnodevelop it comes with is the most retarded editor i have ever come across. i would take fucking vim with no plugins over that piece of shit. the editor itself is a clusterfuck one you add more than 3 different items or objects. it teaches you nothing about computer graphics or even vectors for that point. a unity dev once told me that vectors were something unity invented and no other engine could trump. unity is shit and the 8 yr old script kiddies who keep pumping tons of shit green lights on to steam are the only thing keeping it alive.
>>
>>55528492
Idgi
>>
>>55525463
Where is calculus used in programming/cs?
>>
>>55528580
physics.
>>
>>55528593
anything else ?
>>
>>55528580
at nasa
and at the LHC
>>
>>55528569
>the only thing keeping it alive

KSP, Ori and the Blind Forest, SuperHot, Hearthstone, etc etc.

Lots of good games use unity. It's a tool.
>>
>>55528580
Programming languages are calculi
>>
>>55528605
calculators
>>
>>55528593
>>55528611
I still don't understand. How are those related to computer programming? Physics, as in graphics?
>>
>>55528580

Machine learning.
Any novel algorithm where knowing the rate of change of something may be useful.
>>
>>55528646
seriously?
>how 2 get rover 2 land on mars?
>physics
>how 2 solve physics problem?
>calculus
>>
File: 1423698378360.jpg (57 KB, 350x350) Image search: [Google]
1423698378360.jpg
57 KB, 350x350
>>55528494
If you don't have any options right now, I recommend getting on Github and working on some of your own side projects or contributing to things.

Also, while you are doing that, brand yourself online well. Brag about your awesome work, and put it on things like Stack Overflow Careers or LinkedIn. If you are the writing type, make a blog--even a Jekyll one on Github pages will do, and write about development topics that interest you.

Essentially, if you put yourself out there and have things you can show to employers, it is pretty damn easy finding work. Actually, recruiters start coming out of the woodwork if you do it enough.

Good luck anon..!
>>
>>55528580
Fast fourier transformations
Taylor series
Newtons method
List goes on
>>
>>55528649
Interesting, I'd like to learn more about ml, but it all seems to be post-grad stuff.
>>55528671
Those are physics problems, not computer science.
I'm probably just getting hung up on semantics of different branches of science, though.
>>
std::queue<SDL_Point> frontier;
frontier.push(start_tile);
std::map<std::pair<int, int>, bool> visited;
visited[std::make_pair(start_tile.x, start_tile.y)] = true;

SDL_Point current;
while (!frontier.empty())
{
current = frontier.front();
if (grid[current.y][current.x + 1] == '1' || (!visited[std::make_pair(current.y, current.x + 1)]))
{
frontier.push({current.y, current.x + 1});
visited[std::make_pair(current.y, current.x + 1)] = true;
}
if (grid[current.y][current.x - 1] == '1' || (!visited[std::make_pair(current.y, current.x - 1)]))
{
frontier.push({current.y, current.x - 1});
visited[std::make_pair(current.y, current.x - 1)] = true;
}
if (grid[current.y + 1][current.x] == '1' || (!visited[std::make_pair(current.y + 1, current.x)]))
{
frontier.push({current.y + 1, current.x});
visited[std::make_pair(current.y + 1, current.x)] = true;
}
if (grid[current.y - 1][current.x] == '1' || (!visited[std::make_pair(current.y - 1, current.x)]))
{
frontier.push({current.y - 1, current.x});
visited[std::make_pair(current.y - 1, current.x)] = true;
}
frontier.pop();
}


Why would this code cause a crash? It looks fine to me.

(I'm trying to implement the breadth first search algorithm)
>>
>>55528790
>all this repetition
>>
>>55528808
eh, i want it to work before i clean it up
>>
>>55528789
>Those are physics problems, not computer science.
how do you think unmanned space vehicles solve calculus problems on their own?
did they take calculus in college?
>>
File: 281.jpg (4 KB, 215x280) Image search: [Google]
281.jpg
4 KB, 215x280
The original Apollo 11 Guidance Computer (AGC) source code for the command and lunar modules is now on github: https://github.com/chrislgarry/Apollo-11

Neat
>>
>>55528790
out of range, obviously

god im an idiot
>>
>>55528092
What's the use of a fixed-point combinator type? How is it even a type?
>>
>>55529027
It's used for creating recursive / inductive types

data L a b = Nil | Cons a b
-- no recursion
type List a = Fix (L a)
-- the only recursion is in the definition of Fix
>>
File: 1455310679806.png (287 KB, 836x1065) Image search: [Google]
1455310679806.png
287 KB, 836x1065
>>55525463
>CS is a subset of math edition

kek
>>
>>55525667
Gnome == KDE > Windows
>>
>>55528952
cool, now I can cite a specific file where nasa programmed a computer to solve calculus equations
https://github.com/chrislgarry/Apollo-11/blob/master/Comanche055/ORBITAL_INTEGRATION.s
>>
>>55529071
I chuckled.
>>
>>55529071
Is there a difference between /sci/ and reddit at this point?
>>
>>55529282
Butthurt much
>>
Guys, I think I'm like one of the worst programmers ever, but I like doing it.
What do I do?
>>
>>55529071
i should send this to my CS friend. he was always trying to convince us CS is a math/science degree.
Discrete math is babby tier Math.

t. EE that went into programming
>>
>>55529342
>Guys, I think I'm like one of the worst programmers
hallmark of a decent programmer
congratulations, anon
>>
>>55529342
Keep doing it.
>>
what's the name of this function?


if x < y:
return -1
if x == y::
return 0
if x > y:
return 1
>>
>>55529506
it's called "SyntaxError"
>>
>>55529506
compare
>>
>>55529506
Indent level mismatch. But cmp(x,y) if it was
actually correct.
>>
>>55529559
oh I tried cmp and it turns out they took it out of python3. kind of retarded. it's a short method to write but still it was nice having it builtin.
>>
>>55529583
does Python have sign(x)?

compare(x, y) is sign(x-y)
>>
>>55529583
You could try
(a > b) - (a < b)


source: https://docs.python.org/3.0/whatsnew/3.0.html
>>
File: 1467929950562.jpg (127 KB, 1280x720) Image search: [Google]
1467929950562.jpg
127 KB, 1280x720
>>55529604
>(a>b)- (b>a)
>>
>Writing code with unicode
Disgusting. I'll stick with math libraries, thanks.
>>
>>55529675
{-# LANGUAGE UnicodeSyntax #-} is BAE
>>
>>55529506
sign(x-y)
>>
File: 1450379066800.png (24 KB, 189x189) Image search: [Google]
1450379066800.png
24 KB, 189x189
>>55528789
At a basic level, you can describe ML with AI.

For example, when making an AI for a board game, one of the strategies for writing an AI player is to write something called a "Minmax" algorithm, which basically is where the computer looks through possible moves in the board, and then runs each possibility through a function--and that function returns a number saying how good or bad that board position is. After getting a bunch of good candidates, it then does the same thing for all the possible follow-up moves for the player, except looks for the one that gives the player the lowest possible score.

Simple right?

The problem is, how to you write a function that rates a board? There are all kinds of strategies and heuristics for this. You can make winning moves have a nearly infinite score, and make losing moves nearly negative infinite... There is also detracting points for vulnerabilities, or adding them for obvious advantages...

...but one strategy, is Machine Learning.

Imagine if every time a computer lost, it noted its moves in a database or something, and penalized those positions, so the next time, the computer would be less likely to do that thing. You could make a computer get better at the game with experience!

That is machine learning, basically.
>>
File: comfy.png (82 KB, 1183x628) Image search: [Google]
comfy.png
82 KB, 1183x628
Post comfy code
>>
I have a pixel at integer x,y and a floating point vector for this position that points to the "next" pixel.

How would I do the bresenham line algorithm for exactly 1 pixel?

The vector's x and y coordinates are [-1.0,1.0] and is normalized to depict a direction and I wish to get the next pixel that this vector is pointing to with the most minimal "error"
>>
>>55530082
The type checker does a lot of the work in this too, it's pretty good

In the [a] example, it's recursive on only one of the values
>>
File: 859b13b262.png (17 KB, 702x521) Image search: [Google]
859b13b262.png
17 KB, 702x521
>>55530082
>>
>>55530137
This doesn't look very comfy 2bh
Maybe when rangesv3 gets approved
>>
>>55527193
>>55526196
>>55526050
>>55528580
>>55527274
>>55527264
>>55528676
>>55529653
>>55529810
>theses guys get what 4chan is
>everyone else is just shitposting
>>
>>55530326
tru
>>
>>55530119
plz welp
>>
File: 1461465592617.jpg (33 KB, 500x322) Image search: [Google]
1461465592617.jpg
33 KB, 500x322
What language has the syntax equivalent of girly cursive handwriting with hearts dotting the i's written in pink with glitter?
>>
>>55530082
The entire file is like this.

Nothing longer than 20 lines aside from some things a coworker wrote, and super-solid functionality that lets you implement things by just giving the things the right classes to HTML elements.
>>
>>55530506
Ruby
>>
>>55530568
>>>/g/wdg/
>>
>>55530576
How come?
>>
File: o-DEPRESSION-facebook[3].jpg (125 KB, 2000x1000) Image search: [Google]
o-DEPRESSION-facebook[3].jpg
125 KB, 2000x1000
Can someone explain to me what a pointer is, I've been trying to wrap my around this all day.
>>
File: ruby brony.png (15 KB, 796x293) Image search: [Google]
ruby brony.png
15 KB, 796x293
>>55530625
Ruby is a girl and a brony
>>
>>55530644
A pointer point's to an address in memory.
>>
>>55530644
A pointer is a kind of comonad
>>
>>55530644
A variable that holds a reference/memory adress.
Read: Understanding and using C Pointers, for leveling your knowledge with memory and pointers.
>>
>>55530581
Fine, then how's this? (Also what's wrong with JavaScript?)
>>
>>55530644
A pointer is memory that points to other memory.

It is like writing the address to a house. That address points to the house. If you de-reference that written address you get to the house.

Or maybe like a door. That door is a pointer to the room on the other side of it.

A shortcut on your desktop. The program is somewhere else.
>>
File: tumblr_nq7xwmPcsy1uygu1vo1_1280.png (285 KB, 854x470) Image search: [Google]
tumblr_nq7xwmPcsy1uygu1vo1_1280.png
285 KB, 854x470
>>55525667
>>
File: qqqqq.jpg (127 KB, 500x500) Image search: [Google]
qqqqq.jpg
127 KB, 500x500
I'm trying to lean RxJava and I'm starting to understand it through just fucking around, but I'm stuck at figuring out why this doesn't work.
Observable.interval(3, TimeUnit.SECONDS)
.subscribe(new Action1<Long>() {
@Override
public void call(Long arg0) {
System.out.println(arg0);
}
});

It's my understanding that this should print out incrementing integers every 3 seconds.
>>
>>55525667
KDE master race
>>
>>55530681
No, that violates the comonad laws. Pointers have identity.
>>
>>55530119
olp
>>
>>55530980
https://hackage.haskell.org/package/category-extras-0.51.3/docs/src/Control-Comonad-Pointer.html
where
>>
File: Pokegotchi.webm (89 KB, 320x240) Image search: [Google]
Pokegotchi.webm
89 KB, 320x240
I am working on a shitty Tamagotchi clone with Pokemon. (Maybe I'll try uploading the right file this time!)
>>
>>55531038
Looks cute, have a repo?
>>
>>55531038
Good lord...I am having the worst luck with videos.

Why did that truncate?
>>
>>55531038
Can you abandon pokemon until they die?
>>
>>55531046
Aye: https://github.com/Archenoth/Pokegotchi

>>55531052
Yes... Basically if they are not fed, or are sick for too long, they will die.
>>
File: Pokegotchi2.webm (620 KB, 1366x768) Image search: [Google]
Pokegotchi2.webm
620 KB, 1366x768
>>55531069
The whole thing was practice for canvas, and it is actually functionally complete... But there aren't too many part of it that are overly visual, so actually playing it can get kinda boring.
>>
>>55531215
How's the pokegotchi's info stored?
>>
>>55531236
The state of the Pokemon is just inside of the Pokemon object (It's not specific to Pichu).

Pokemon objects contain things like the Pokemon's stats, as well as members that point to the game engine, the canvas context, to an interface object, and so on...

It's not persisted though. I am thinking of making it use cookies though, so I am probably going to pack as much data as I can into a small space so I can just put it anywhere without going over the Cookie size limit, even if a site already uses it.
>>
>>55531215
>gender: male
How many genders are there?
>>
File: 1425498622024.jpg (168 KB, 500x500) Image search: [Google]
1425498622024.jpg
168 KB, 500x500
>>55531311
Just your normal Pokemon fare, 2.
I put that in there because some Pokemon are different between males and females. For example, Meowstics.
>>
I found an old file with a bunch of ideas in it from years ago, and there was one that needed the Billboard API to find the top 100 at any date. But that shit is dead now. Anyone know of something I can use as a substitute? Is there a big fuckin' spreadsheet out there compiled by a supreme autist every week?
>>
>>55531382
http://www.stats.org/new-billboard-top-hundred.html
>>
>>55531464
Links dead over here, is there some hidden login button or something?
>>
File: FUCK.webm (843 KB, 1008x622) Image search: [Google]
FUCK.webm
843 KB, 1008x622
Changed up the searching a bit. I think it looks and functions alright, though its hard to tell when I've been staring at the same shit for hours.
>>
>>55525463
what's the best data structure that allows elements to be very far apart with no wasted memory for the null areas, but also allows for quick random access?
>>
>>55532007
depends

you could use a dequeue or a vector of vectors or something
>>
>>55532007
https://en.wikipedia.org/wiki/Content-addressable_memory
>>
how do I check if the two consecutive bits of a number are set. Like say
>00000110
I want to check those two bits. Right now Im thinking something like
int x=6;
if ( ((x>>1) &3) == 3)
cout<<"true";
>>
File: Untitled-1.gif (6 KB, 404x391) Image search: [Google]
Untitled-1.gif
6 KB, 404x391
>>55530119
elp
>>
>>55532058
>>55532049
my problem is I have a bunch a structs with data that need to maintain numerical order, but can be placed randomly into an array, but reading it is linear. The array would look something like this:

{1, 2, 0, 0, 0, 0, 0, 9, 10, 0, 0, 0, 0, 0, 16}


but I wish to store it like this
{1, 2, 9, 10, 16}


A linked list fits the bill perfectly, but I cannot easily insert a random element and have it be in the right order without iterating O(n).

would a hash table work?
>>
>>55532078

If no two consequtive bits are set, ((x>>1) & x) == 0.
>>
>>55532205
Well Im actually decoding a word so Im checking indexed bits and not just if two bits are set consecutively. But judging from the fact that you used the same general method of looking at the bits Ill assume this is how its normally done.
>>
File: medieval_village.jpg (174 KB, 1213x658) Image search: [Google]
medieval_village.jpg
174 KB, 1213x658
What is the most portable version of C? Is it ANSI?
>>
>>55532680
C89
>>
>>55532680
C89, though pretty much every compiler supports features from C99 as extensions because they're so handy.

In fact, the entireity of C99 and C11 was based on standardizing GNU C extensions in GCC.
>>
>>55525649
The D community is truly blessed to have your towering intellect on the mailing list.

http://forum.dlang.org/post/[email protected]
>>
>>55530728
>Putting strings inside the function that are basically comments and are never used

I've seen this in Python as well. Why is it done? Why not just write a comment instead?
>>
>>55532680
>C
>portable
>ever
>>
>>55532795
it's more portable that java
>>
>>55528010
Not in R2 you won't motherfucker
>>
>>55532761
In Common Lisp, those are actually the documentation for the function, and you can get them with a (documentation ...) call.

Also, the documentation pops up in things like Autocomplete when you are typing elsewhere. It is very handy. (If that makes sense..?)
>>
>>55532740
I just lurk the forums desu
>>
>>55532907
Is this an emacs-specific thing that expanded to other editors because emacs did it, or is there a reason that regular comments can't be used as doc comments?
>>
>>55532921
Just so you know, I'm not Jack. I have no idea if he browses /g/.
>>
>>55532954
Ketmar seems like the kind of asshole that would
>>
>>55532971
Can you guess who I am?
>>
>>55532936
Nope, it's actually built into the language that way.

(defun ...) creates a function and assigns it in the current namespace, and it has a "documentation slot" that will be filled with any string that is put after the arguments list if it exists.

Without Emacs, you can just pull it right from the function argument, or use (documentation ...)
>>
I am looking for a container data structure of sorts. Anything I call a set has constant-time lookup and can be traversed.

The elements I need to put in the data structure will have a a function defined that produces a set of tags. The following operations should be supported:

Insertion: Reasonably fast. I will be inserting probably 1000 elements at most and it shouldn't take more than a few seconds.

Lookup: I will want to index into the container using a set of tags. The result should be a set of elements, each of which has their tags being a subset of the tag set used to index the container. I would hope this is at most linear in the number of tags in the index or tag-sets of elements, and sublinear in the number of elements in the container. There is a trivial solution to be linear in both the tag-set size (of the elements) and linear in the container size: Just iterate through each element and check if each of the element's tags are in the index set.

More often than not lookups will not result in any matches.
>>
File: banana1.gif (780 KB, 256x256) Image search: [Google]
banana1.gif
780 KB, 256x256
>>55530119
>>
>>55532987
>function argument
function object*

Pardon.
>>
>>55532985
A.B
>>
>>55533014
No. Also sorry for leading you on, because I wouldn't tell you who I am on the mailing list even if you guessed correctly.
>>
>>55533027
Alright Andrei
>>
File: 7phuJaq6[1].jpg (42 KB, 512x512) Image search: [Google]
7phuJaq6[1].jpg
42 KB, 512x512
>>55533037
You found me out
>>
>>55533048
DUDE GARBAGE COLLECTION LMAO
>>
>>55526427
I am also doing cs50x anom, what's your skype?
>>
>>55525599
well, yesterday a friend and i made a game, you can play it in: www.omri.org.mx/karelman/
>>
>>55533058
Really though, I am excited that `scope` and `return` are finally getting implemented properly so I can write safer non-GC code. Times are exciting.
>>
>>55532795
C is one of the most portable languages.
Can Java run on non 8-bit byte computers?
>>
>>55533080
Quite a few things to get excited about (what do you mean about those btw, I haven't seen news about them). Cleaner documentation seems to be a bigger focus, DUB is going to be shipped with dmd
Plus
>Eliminate Phobos dependency on GC (in other words, make GC opt out a viable and simple option).
pls make it happen Andrei
>>
>>55533154
>>Eliminate Phobos dependency on GC (in other words, make GC opt out a viable and simple option).
it should be opt in 2bh
>>
>>55528952
>now
>>
>>55533235
5 days ago, whatever.
>>
>>55533154
>what do you mean about those btw
`scope` is an old concept that was mostly un-implemented until now. A scope variable cannot be assigned to a variable in an outer scope. Ex:

void main()
{
int* p1;

{
scope int* p2 = new int;
p1 = p2; //Error
}
}


`return` is fairly new. @safe functions that accept an argument by ref cannot return that argument anymore unless it is annotated as a `return ref` (this is inferred for template functions). Ex:

@safe:
ref int fun(ref int a) { return a; } // ERROR
ref int gun(return ref int a) { return a; } // FINE
ref T hun(T)(ref T a) { return a; } // FINE, templates use deduction


https://wiki.dlang.org/DIP25
https://wiki.dlang.org/DIP90
>>
>>55533266
I wish C had anonymous scope

it would make large functions much less of a mess
>>
>>55525995
>Let's use product orders as an example.
>>Bob buys 200 foobars
>How would I add this without either memorizing the customer_id for Bob as well as the product_id for foobars or needing to look them up every time?
You use SQL.
>>
>>55528076
symbolhound
>>
>>55533266
is this return value stuff similar to Rust's borrow checker?
>>
>>55533362
Yes, it's similar in concept but less powerful.
>>
File: 1463325532607.png (2 MB, 1280x720) Image search: [Google]
1463325532607.png
2 MB, 1280x720
>>55525463
>CS is a subset of math edition
I dig it. Gonna learn nLab and Coq after I get familiar with C++ desu.
>>
File: 1466725042127.jpg (32 KB, 557x612) Image search: [Google]
1466725042127.jpg
32 KB, 557x612
>>55533492
>Coq
>>
>>55528494
launchcode.com bruv
>>
File: 1459657295496.png (532 KB, 602x699) Image search: [Google]
1459657295496.png
532 KB, 602x699
>>55526050
>>
what name should I use for a function that allocates all that needs to be allocated in a struct?

It can't be "init_struct" because allocation shouldn't be mixed with initialization.
What if you want to initialize the struct again without reallocating?

alloc_struct?

but that implies I am allocating the struct itself, which has already been done.

why does naming have to be literally the hardest part of programming?
>>
>>55533709
alloc_struct_members?
>>
>>55533709
struct_malloc

falloc_struct
>>
>>55530644

EVERYTHING YOU EVER WANTED TO KNOW ABOUT POINTERS RIGHT HERE

http://cslibrary.stanford.edu/102/PointersAndMemory.pdf
>>
>>55533726
this is alright

I would normally allocate the members along with the struct, but I am working with an array of structs
>>
File: 1466277628928.jpg (122 KB, 692x864) Image search: [Google]
1466277628928.jpg
122 KB, 692x864
>>55525463
Trying to not killing myself, I've noticed that I spent mor etime debugging my app rather than actually adding features. I blame MVVM.
>>
>>55533824
>to not killing
Not even drunk btw.
>>
>>55529378
More like babby intro to discrete is babby

Or did fucking genius you solve the Goldbach conjecture? Or P = NP? Can you do ILP as easily as LP now?
>>
Brand new to this whole python GUI thing but I could really use some guidance on this. My program is slowing exponentially the more elements it loads, I think. I put a comment at the worst bit.

http://pastebin.com/w2V4Vr3H
>>
>>55531848
Is there some algorithm that you based this on? I need to write something similar soon and I'm not sure where to start.
>>
>>55533894
did any CS major?
>>
>>55533937
read the docs on Soup.findAll() it's recursive. so you're basically parsing the entire HTML document over and over and over.
what is the file you're trying to parse?
>>
File: uno.jpg (238 KB, 600x600) Image search: [Google]
uno.jpg
238 KB, 600x600
i am trying to convert the temp value to int, the library i am using is SparkFun MLX90614. It is not working for me. any help? this line i am trying to make spit out the int.

Serial.print("Object: " + String(therm.object(), 2));
>>
>>55534197
Can you already convert it to a string?
If so, what does it look like?
Thread replies: 255
Thread images: 48

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.