[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/ - D 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: 26
File: ;D.png (57 KB, 800x334) Image search: [Google]
;D.png
57 KB, 800x334
Old Thread: >>51699144
Post your rare .d's
>>
>No anime pic
Try again when we're on page 8 faggot.
>>
>>51702900
Fuck that's beautiful.

My next project will likely be in D.
>>
>>51703032
It's okay, this fixed it.
char*********************************************************************************************************************************************************************************************************************************************************************************** zorp;
zorp=(char***********************************************************************************************************************************************************************************************************************************************************************************)malloc(1);

***********************************************************************************************************************************************************************************************************************************************************************************zorp='m';

std::cout<<***********************************************************************************************************************************************************************************************************************************************************************************zorp<<'\n';
free(zorp);
>>
>>51703074
I don't even think C supports this many levels of indirection.
>>
>>51702900
{throw new Exception("Can not calculate n! for n < 0");}()

Is this what I think it is?
>>
>>51703155
>I don't even think C supports this many levels of indirection.

Why wouldn't it?
>>
DAILY REMINDER THAT THIS IS VALID C CODE
#define ayyy(x) x(lmao(x))
#define lmao(x) x(ayyy(x))
int main()
{
int(*){} ayyy(lmao)
}
>>
>>51703155
http://ideone.com/qsoFba
>>
So I'm probably going about this the wrong way, but:

I have a main server class in C# that creates async sockets for each client that connects. Works great. But I'm trying to factor everything out so it's not one gigantic blob of shit.
I decided a logical place to start would be to separate out the backend commands that sift through the data and run SQL queries and whatnot.

However, this means I'm now having to pass around a bunch of socket information every time a call has to be made, processed, and then a response sent. Is there any way to set a class instance variable, and then simply update it on a main entry method every time it's run? Or will this recreate the object every time and be a huge memory waste?
Is it better to simply leave everything as passed variables to each method every time?
>>
>>51703338
OPs post is okay-ish but the amount of SJW makes me cringe.

"Personally in that case I'd be concerned about another PR popping up someday (not from me, but someone) because both names are male or something. Just covering all the bases."
>>
>>51703074
Segmentation fault (core dumped)
>>
>>51703323
no it aint
>>
>>51702943
No anime, it's for degenerates
>>
>>51703517
http://ideone.com/EWBeCY
>>
File: microexpressions-contempt.jpg (28 KB, 524x336) Image search: [Google]
microexpressions-contempt.jpg
28 KB, 524x336
>>51702900
>xamarin studio
>>
>>51703564
stop changing the code

https://ideone.com/rtbgu5
>>
>>51703564
>C++14
>>
File: file.png (30 KB, 841x449) Image search: [Google]
file.png
30 KB, 841x449
>>51703323
>Implying
>>
Having a really fucking hard time with this for the last 3 hours, why the hell won't this stupid program run?

(define (pointwise f L1 L2)
(let ((L1 (force L1)) (L2 (force L2)))
(cond
((null? L1) '())
((null? L2) '())
(else (cons (f (car L1) (car L2))
(delay (pointwise f (cdr L1) (cdr L2))))))))

(define fibs (cons 1 (cons 1 (delay (pointwise + fibs (cdr fibs))))))

; Give the n-th element of a lazy list
(define (n-th L n)
(let ((L (force L)))
(if (positive? n) (n-th (cdr L) (- n 1))
(car L))))
>>
>>51703612
Is that the bastard child of cmd and ps?
>>
>>51703668
Babun. I find it useful.
>>
>>51703660
Don't use car and cdr on a stream (what you call lazy list), use stream-car and stream-cdr, or head and tail. stream-cdr automatically forces a delayed second argument, and stream cons automatically delays the second argument. They way you write it now, cdr doesn't automatically force delayed arguments, so (n-th (cdr L) (- n 1)) applies to n-th not a stream but a promise of a stream.
>>
>>51703323
code.cpp: In function 'int main()':
code.cpp:7:10: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
int(*){} ayyy(lmao);

It does compile and execute though.
With gcc.
>>
>>51703733
>stream cons
*cons-stream
>>
How do I make msys not shit?
>>
>>51703736
>.cpp
>>
>>51702900
thank you for doing this, OP. seriously, thanks
>>
File: 1425029056511.png (42 KB, 512x512) Image search: [Google]
1425029056511.png
42 KB, 512x512
>>51703736
>only pretending
>>
>>51703733
>dynamic typing is okay, they said
>>
>>51703660
Also you can't do
 (let ((l1 (force l1)) (l2 (force l2)))
>>
>>51703759
You use linux instead
>>
>>51703323
>trolling is a art

>>51703517
>>51703612
>>51703736
you fell for the b8, retards
>>
I am assuming you are asleep, my shift will be over soon so I will try to work on it some more then. I'm not sure if I'm doing this correctly

i've got this:

void loadEntityPrototype(lua_State *vm, int prototype, const char *path) {
luaL_dofile(vm, path);
lua_pushnumber(vm, prototype);
lua_getglobal(vm, "prototype");
lua_settable(vm, LUA_REGISTRYINDEX);
}


I assume I use it before anything else (like use it in my main function)

I ran it like so:

loadEntityPrototype( LS, 0, "./objTest.lua" ); 


inside that objTest.lua is (what you had given me earlier, unchanged)

prototype = {
new = function()
return {
name = "Sample",
foo = 0
}
end,

update = function(self)
self.foo = self.foo + 10
end,

draw = function(self)
return "%s(%d)":format(self.name, self.foo)
end
}


anyways, i've made me a new entity but it crashes because the table index is nil. so im sure it's not the code, im sure i'm not putting something in correctly

at this point I just need to know if I am doing it wrong still
>>
>>51703777
>any typing at all
λi. (λs. (λh. i (λg. g) (λy. (λd. i (λg. g) (y d (λo.o))))))
>>
>>51703759
You use msys2. Dummy.
>>
>>51703826
t. Athanasios (λΧ. Χ Χ)(λΧ. Χ Χ)
>>
>>51703779

I don't understand, why not? The only thing that snags an error message is something wrong with one of my cdr's which I'm going to try and fix as per the other anons stream suggestion.
>>
>>51703759
Install GNU/Linux.
>>
>>51703852
nvm, it seems you can do it, but it's very risky nonetheless.
>>
>>51703836
what's this "all me" meme?
>>
Is it allowed to have derived class with the same name as the parent, provided the namespace is different? c++

#include <SFML\Graphics.hpp>
namespace myproject
{
class Drawable : sf::Drawable
{
public:
Drawable();
~Drawable();

protected:
// Inherited via Drawable
virtual void draw(sf::RenderTarget & target, sf::RenderStates states) const override;

};
}

>>
>>51703823
>I am assuming you are asleep
Who are you talking to?
>>
>>51703931
yes
>>
>>51703823
I'm wide awake.

Where does it crash?
>>
>>51703941
anon who was helping me yesterday
>>
>>51703931
yes, that's like one of the main reasons to have namespaces.
>>
>>51703931
That's the entire point of namespaces. That's literally all they do.
>>
How do I program a anime?
>>
>>51703946
>>51703955
That's what I thought but when I used the create definition option in vs2015, it jumped to the sfml base class header file, I assume that that is an error by microsoft?
>>
>>51703948
im just in a testing mode right now, my main function has this in it

loadEntityPrototype( LS, 0, "./objTest.lua" ); 

g_ENT_add ( 0 );


crashes at g_ENT_add()

void g_ENT_add ( int prototype ) 
{
int entity = highest_used_entity;

g_ENT[ entity ].prototype = prototype;

lua_pushlightuserdata(LS, g_ENT + entity);
lua_pushnumber(LS, prototype);
lua_gettable(LS, LUA_REGISTRYINDEX); // get the prototype table
lua_pushstring(LS, "new");
lua_gettable(LS, -1); // get the constructor
lua_pcall(LS, 0, 1, 0); // call the constructor
lua_settable(LS, LUA_REGISTRYINDEX); // register the data table with the entity's address

highest_used_entity++;
}


and I think that's because the prototype didn't load correctly?
>>
>>51703963
ijot
go home Oracle
>>
>>51703976
Can you track it down to a specific function call?

>>51703981
Well, I suppose preventing name collisions applies to constants and free functions as well, if you want to split hairs.
>>
Using EntityFramework in C#, it hits the LINQ query but then...nothing
It just brings the console window back up, as though it's waiting for a response from there.

                    Console.WriteLine("Did it hit before?");
var user = (from x in db.Users
where x.Username.ToLower().Equals(username.ToLower())
select x).FirstOrDefault();
Console.WriteLine("Did it hit after?");


I've stepped through it as much as I can, but every time it hits the linq statement, then pops the console window back up. Never lets me step through it, never writes the post-linq statement.
I'm baffled.
>>
>>51704055
within that add function

lua_settable(LS, LUA_REGISTRYINDEX); // register the data table with the entity's address
>>
>>51703155
> I don't even think C supports this many levels of indirection.
It doesn't. 5.2.4.1p1 (Translation limits):
         -- 12 pointer, array, and  function  declarators  (in  any
combinations) modifying an arithmetic, structure,
union, or incomplete type in a declaration

None of that has anything to do with the code being completely invalid (only the first pointer is initialised).
>>
>>51704058
Also, there's not even exceptions. nothing.
It literally just stops. It's not even exiting out to the main startup thread because I can create additional connections to it and it properly logs them.
>>
>>51704058
use the better LINQ syntax, also skip the redundant where

db.Users.FirstOrDefault(x => x.Username.ToLower() == username.ToLower());
>>
>>51704087
What's db.Users? sqlite?
>>
>>51704077
Hmm, that's odd. It's almost like it's saying you can't use a pointer (lightuserdata) as a table index, but it's definitely allowed. And my stack manipulation seems to be fine.
>>
>>51704096
I actually had it in Lambda format, but since I started getting this bizarre issue I put it back into dummy linq.
Didn't think about putting the first query in front though.

>>51704114
Correct. Sqlite with two tables, one of which is Users.
It's set to Always Copy into the build.

Full method snippet is
public User userAuthenticate(string username, string pass)
{
using (var db = new CampaignContext())
{
try
{
//User user = db.Users.First(u => u.Username.ToLower() == username.ToLower());
Console.WriteLine("Did it hit before?");
var user = (from x in db.Users
where x.Username.ToLower().Equals(username.ToLower())
select x).FirstOrDefault();
Console.WriteLine("Did it hit after?");
if (user != null && user.Password == pass)
return user;
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
return null;
}
}


And in their own respective class pages are
    public class CampaignContext : DbContext
{
public DbSet<User> Users { get; set; }
public DbSet<Token> Tokens { get; set; }
}

and
    public class User
{
[Key]
public Guid GUID { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public string Role { get; set; }
}
>>
>>51704147
P.S. Yes I know the authentication method has unnecessary crap in it right now. I've just been throwing shit at the wall to see what sticks at this point.
>>
variables declared "above" a block are accessible within that block, right?

main() {

int g = 1;

{
cout << g;
}
}
>>
>>51704055
it's not just for name collisions
>>
>>51704147
I think sqlite actually has it's own DB query syntax identical to LINQ. Hover over the var and check the return value, perhaps it's a async query?
>>
>>51704166
Alright, what else do they do? Enlighten me.
>>
>>51704160
forgot to mention it's c++
>>
>>51704160
>>51704181
Why don't you try?
>>
>>51704181
>>51704160
Yes, and after the block.
It's called scope - read up on it.
>>
>>51704160
Why wouldn't they be?
>>
how would i make a toString method in java that displays if a fraction is positive or negative?

E.g. this toString
public String toString() {
return "[ " + "+ " + numerator + "/" + denominator + "]";
}


Would display the client code as [ + 5/1] assuming that the client entered 5 as the numerator and 1 as the denominator.

But if the user entered -5 as the numerator, how do I make it so that the console prints a "-" symbol instead of a "+" symbol when the toString is called?
>>
>>51704146
interesting, well just so I can show the relevant stuff I have together:

..stuff

#define MAX_ENTITES 768

typedef struct
{
int prototype;
} entity;

entity g_ENT[ MAX_ENTITES ];

lua_State *LS;

..stuff

void loadEntityPrototype(lua_State *vm, int prototype, const char *path) {
luaL_dofile(vm, path);
lua_pushnumber(vm, prototype);
lua_getglobal(vm, "prototype");
lua_settable(vm, LUA_REGISTRYINDEX);
}

void g_ENT_add ( int prototype )
{
int entity = highest_used_entity;

g_ENT[ entity ].prototype = prototype;

lua_pushlightuserdata(LS, g_ENT + entity);
lua_pushnumber(LS, prototype);
lua_gettable(LS, LUA_REGISTRYINDEX); // get the prototype table
lua_pushstring(LS, "new");
lua_gettable(LS, -1); // get the constructor
lua_pcall(LS, 0, 1, 0); // call the constructor
lua_settable(LS, LUA_REGISTRYINDEX); // register the data table with the entity's address

highest_used_entity++;
}

int main ( int argc, char *argv[] )
{
LS = luaL_newstate();
luaL_openlibs(LS);

if( luaL_loadfile( LS, "./main.lua" ) )
exit(0);
if( lua_pcall( LS, 0, 0, 0 ) )
exit(0);

loadEntityPrototype( LS, 0, "./objTest.lua" );

g_ENT_add ( 0 );

...stuff

return 0;
}
>>
File: Untitled.png (7 KB, 411x132) Image search: [Google]
Untitled.png
7 KB, 411x132
>>51704176
Doesn't look like it, returns correctly as a User object.
And I can't imagine why it would screw up the whole application, that table only has two records in it.
>>
>>51704226
Oh, I've found my problem.

Try changing the -1 to -2. -1 references the top of the stack, so it's trying to lookup some undefined index from the table "new".
>>
so i'm using UdpClient joinmulticastgroup method, and i'd start recieving and sending messages.
but the client that sends a message will also recieve that message,
Can i control from who to get the message from?
is there a way to ID people and who i'm getting messages from using the multicast group?
I should probably mention using C#
>>
>>51704236
var user = await db.Users.ToListAsync().FirstOrDefault(x => x.Username.ToLower() == username.ToLower());
>>
File: 213123213.jpg (16 KB, 480x360) Image search: [Google]
213123213.jpg
16 KB, 480x360
Can somebody explain how the Babylonian method of finding square roots works?

It's not that I don't understand what it does or what it is, but it seems like actual sorcery to me. Just
x=(x+y/x)/2
over and over and then somehow that makes square root? This shit blows my mind man.
>>
>>51704358
it's simple, really. you just
>>
File: dangerous-pepe.jpg (13 KB, 222x216) Image search: [Google]
dangerous-pepe.jpg
13 KB, 222x216
>>51703759
uninstall windows
install gentoo
>>
That didn't fix it, but it did give me a timeout error that it could not load or access the DB.
Which led me to my app.config
Which led me to realize I had renamed the fucking database context name when I was refactoring, but hadn't updated it.

I'm retarded. Thank you.
>>
>>51704442
to
>>51704289
>>
>>51704442
Don't sweat it, these errors happen to everyone and always take the longest to fix.
>>
Any unity/C# programmers in here?

For my final project in an intro graphics course this semester I get to choose what to make, applying some concepts we learned.

I want to make a 2-player pong game, but with some additional cool physics. Any ideas? Project should take 10-15 hours
>>
Anyone here has any experience with natural language processing?

I have to do a resume parser. It has to detect each section of a resume (education, work experience) and it must detect name, organizations, and as much information as posible.

For the sections i've used a few regular expressions. As for the name entity recognition I then tokenize each section, do POS tagging (trained using Conl2002) and chunk using a Naive Bayes Conll2002 trained chunker.
I'm using Python and NLTK.

The results are okish. Any tips? Does anything look very wrong?
>>
>>51704490
Aren't those graphics courses about making your own stuff with basic opengl calls, reinventing matrix transformations et cetera?
>>
>>51704179
>that's literally all directories do!
>>
what language should i learn to get a gf like pic?
>>
File: 1448066729810.jpg (24 KB, 401x372) Image search: [Google]
1448066729810.jpg
24 KB, 401x372
>>51704490
>final project in an intro graphics course
>use an engine which removes all actual graphics programming
>>
>>51704563
Holy shit look how soft that ass was
>>
>>51704563
Ebonics.
>>
File: 2061.jpg (93 KB, 533x700) Image search: [Google]
2061.jpg
93 KB, 533x700
im gonna start developing for android and i read there are two ways of developing for it
>android studio (slow)
>java (never coded)
>official google support
or
>qt/c++ (many years of experience)
>qml / quick (dont know)
>qt creator

any qt/c++ programmers here? what should i do?
>>
>>51704576

>intro graphics
>intro

I'm not even interested in this field, it's a degree requirement

>>51704538

basically, no opengl though

it's babby graphics but not quite as bad as using the drag and drop features of Unity itself
>>
>>51704358
(positive x)
if x*x > y
y / x < sqrt y
and
x > sqrt y
so average them (they're either side of the goal) and try again
>>
>>51704576
And people try and tell me that corporations aren't manipulating STEM from behind the scenes in order to muscle out the competition by ensuring developers are dependant on their products.
>>
>>51704607
(positive x)
if x*x < y
y / x > sqrt y
and
x < sqrt y
so average them and try again
>>
File: olivia jensen.webm (1 MB, 1280x720) Image search: [Google]
olivia jensen.webm
1 MB, 1280x720
>>51704577
it's all yours, friend
>>
>>51704490
>applying some concepts we learned
and what did you learn about?
>>
File: 2015-12-05-1619-56.webm (3 MB, 894x964) Image search: [Google]
2015-12-05-1619-56.webm
3 MB, 894x964
When should particles have collision detection with each other? They're shot in a stream, so when they're blue it might just fuck it up. Maybe when they're yellow?

>Blue = unbounced particles
>Yellow = bounced particles
>Pink = particles that won't bounce anymore*

* i.e. their speed is 0 or there's no floor underneath them
>>
File: 1428715071265.gif (1008 KB, 320x240) Image search: [Google]
1428715071265.gif
1008 KB, 320x240
>>51704662
That, my friend, is disgusting .
>>
>>51704253
to
lua_gettable(LS, -2); // get the constructor
? still crashed

I just put a print command in the objTest.lua file, because dofile should print it if it sees it, and it doesn't
>>
>>51704688
they should always have particle collision
make them smaller baka
>>
>>51704586
underrated post
>>
>>51704662
Not even yoga pants could manage to make that look good.
That's an ass made of 98% cellulite.
>>
>>51704663

procedural programming and generation of shit like mazes

interpolation

implementing kinematics

etc., basic stuff

I was thinking a matrix mode with interpolated physics for the pong ball path
>>
>>51704721

They're all shot from the same point, though. Gravity isn't strong enough to pull them away from each other in the span of a single cycle.
>>
>>51704730
>>51704690
betas, the lot of you
>>
>>51704732
what the fuck even is procedural programming
>>
>>51704739
You can make a stream without them colliding when they're blue though. That would only be a problem if they were overlapping by default. The fact they are all moving at the same speed should make collision when they are blue a none issue.
>>
>>51704604
There's nothing hard about basic opengl, it's just by hand writing out triangle coordinates.
>>
>>51704739
then offset them instead of making hacks to fix hacks
>>
>>51704760
I think he means procedural generation, random maps etc.
But, how is that "intro graphics", would think that's more data structures and algorithms.
>>
>>51704710
Same error, same place?
>>
>>51704785
... so he just means he learned procedural generation

i thought it was meant to be like a fucking paradigm or something
>>
>>51704812
if it's -1, the error I get is when I settable

<table index is nil>


if it's -2, it crashes at the gettable

<attempt to index a nil value>
>>
>>51704785

yes this

They extend that kind of learning to generation of maps/plants/etc.

you have to see the forest for the trees first
>>
>>51704863
tell me when you learn something difficult
>>
>>51704863
>generation of maps/plants/etc
like meshes?
>>
>>51704858
Okay, so you're right, the dofile is failing somehow. Wrap it up and print out the error.
>>
>>51704928
>wrap it up and print out the error

do what now?
>>
>>51704937
if(luaL_dofile(vm, path)) {
printf(lua_tostring(vm, -1));
}


I'd really suggest you try to understand how the Lua API works, yourself. I'm not going to be around or willing to help every time something doesn't work.
>>
How is text normally handled in a word processor? It seems like putting it all in one big array would arbitrarily insert new characters since you'd have to copy all the displace text.
>>
>>51705017
*would make it difficult to
>>
>When a function call f(A, B) is evaluated, expressions A and B can be evaluated in any order. If order of evaluation is important (which it is for reading a tree), do the evaluations in separate statements before doing the function call.
uhh is this true? can i not do
 Node* nonleaf = new Node(treeFromBinary(tree->left), treeFromBinary(tree->right)); 
? or am i misunderstanding what he's saying?
>>
>>51705017
list<array<wchar_t, 1000>>
>>
>>51704968
void loadEntityPrototype(lua_State *vm, int prototype, const char *path) {
//luaL_dofile(vm, path);
if(luaL_dofile(vm, path)) {
printf(lua_tostring(vm, -1));
}
lua_pushnumber(vm, prototype);
lua_getglobal(vm, "prototype");
lua_settable(vm, LUA_REGISTRYINDEX);
}


I get

'end' expected <to close 'function' at line 15> near ':'PANIC: unprotected error in call to Lua API <attempt to index a nil value>


what I see:

-- test object

prototype = {
new = function()
return {
name = "Sample",
foo = 0
}
end,

update = function(self)
self.foo = self.foo + 10
end,

draw = function(self)
return "%s(%d)":format(self.name, self.foo)
end
}


line 15 is draw

gonna drive home now will brb
>>
>>51705045
Oh, I assumed you could use "...":format(...) instead of format("...", ...). I guess you can't.
>>
>>51705017
Gap buffer or a rope (binary tree with small substrings as nodes, weighted by sum of string lengths in the leaf subtrees)
>>
>>51705029
c++ btw
>>
File: DPTChristmas1.png (332 KB, 588x390) Image search: [Google]
DPTChristmas1.png
332 KB, 588x390
>>51702900
http://adventofcode.com/

25 Christmas-themed challenges
>>
>>51705029
You can do it, just don't expect them to be evaluated in any particular order. I don't understand what you're having trouble with.
>>
>>51705117
>>
>>51705125
the first thing given to node's constructor is the left subtree, and the second one is the right subtree. there wouldn't be the potential of them being flipped or anything right? why is my prof warning me about this?
>>
>>51705159
s
holy
i
t
>>
>>51705159
>what is a fake account
I'll post them here for you Mr. Lazy
>>
>>51705199
He means that this could happen:
Node *left = treeFromBinary(tree->left);
Node *right = treeFromBinary(tree->right);
Node *nonleaf = new Node(left, right);

or this could happen:
Node *right = treeFromBinary(tree->right);
Node *left = treeFromBinary(tree->left);
Node *nonleaf = new Node(left, right);

and that you shouldn't depend on either.
>>
>>51705218
>contributing to facebook
>>
>>51705245
i see, thanks
>>
>>51705218
Still contributing to this kind of behaviour.
>D-DON'T BE EVIL GUYS
>>
>>51705310
>the only company with a do no evil policy
>the only company to fail to uphold a do no evil policy
>>
In c++, how do I remove all whitespace after the delimiter with getline() when reading data from a file?

I have ignore(1) to ignore the newline character, but if there are possibly tabs or spaces, I need those removed too.

getline(inputFile, notes, ';');
inputFile.ignore(1);
>>
>>51705334
You know, it's sad. I actually kind of believe that Eric Schmidt was sincere.
>>
>>51705374
check for invisible characters?
==' '
>>
>>51705374
Whitespace behaves like a character.
>>
>>51705408
also use string.length()
>>
File: xmas.png (2 KB, 640x416) Image search: [Google]
xmas.png
2 KB, 640x416
>>51705117
>>51705159

Day 1: https://paste.installgentoo.com/view/raw/770a1225
Day 1 input: https://paste.installgentoo.com/view/raw/ae0e09d8

Day 2: https://paste.installgentoo.com/view/raw/a1d7af1c
Day 2 input: https://paste.installgentoo.com/view/raw/75f7f51f

Day 3: https://paste.installgentoo.com/view/raw/0eb17a9e
Day 3 input: https://paste.installgentoo.com/view/raw/5dbccc12

Day 4: https://paste.installgentoo.com/view/raw/e1e9f76c
Day 4 input: https://paste.installgentoo.com/view/raw/ca32e94d

Day 5: https://paste.installgentoo.com/view/raw/70bcb8ec
Day 5 input: https://paste.installgentoo.com/view/raw/9af42714
>>
what's the command in linux to give a file a name instead of it being named a.out when i'm compiling it?
>>
>>51705619
>this post
>>
>>51705619
It's not a Linux command, it's an option you can pass to the gcc compiler.

gcc myprogram.c -o myprogram
>>
>>51705619
>>51699784
>>
>>51705619
-o filename.exe

Never even touched Linux.
>>
>>51705619
gcc test.c && mv a.out test
>>
>>51705627
>>51705640
>>51705644
>>51705648
>>51705661
thanks guys i'm not good at linux, i'm an apple-fan because i just works
>>
>>51705640
>>51705661
>gcc
>>
>>51705695
it has nothing to do with linux, it's the exact same command on windows and osx
>>
>>51705695
it's the same deal on OS X if you are using clang or gcc
>>
>>51705696
Yes?
>>
int i,k=0;
while(i<string1.length())
if(string1[i++]!=' ')string2[k++]=string1[i-1]
>>
more languages should use whitespace for function application built-in currying/uncurrying

those are literally the only good features of haskell
>>
>>51705783
white space should only be used to help readability, it shouldn't actually mean anything to the computer
>>
File: tree.jpg (11 KB, 243x255) Image search: [Google]
tree.jpg
11 KB, 243x255
>>51705595
Answers:
https://paste.installgentoo.com/view/53c0e3b7
>>
http://ideone.com/sqN5Yf
>>
>>51705374
use a dummy string to read the rest of line (without delimiter)

getline(inputFile, dummy);
>>
File: Untitled.png (45 KB, 716x690) Image search: [Google]
Untitled.png
45 KB, 716x690
Now what?
>>
>>51706019
You solve part two on each problem
>>
>>51705783
This becomes annoying in some cases, especially when you don't have the "$" operator.
Also this is not unique to Haskell at all, it was used in ML before.

>>51705814
So "a b" should mean the same as "ab"?
>>
File: plebs vs pats dpt.png (55 KB, 839x777) Image search: [Google]
plebs vs pats dpt.png
55 KB, 839x777
>>
File: 1401902027020.jpg (17 KB, 200x199) Image search: [Google]
1401902027020.jpg
17 KB, 200x199
>>51706063
>php
>>
>>51706063
>PHP
DELETE THIS
>>
>>51706063
Java is literally the best language lmaoing at your life
>>
Ruby is for trannies..
>>
>>51706063
Nice trips.
>>
>>51706095
PHP is classic
>>
>>51706063
>PHP
I am being rused

>Assembly
Why do you faggots take superiority in knowing assembly when you obviously won't use it and obviously aren't good at it?
There's nothing superior about writing a program in 100% assembly, you'll just be wasting your time
>>
>>51706095
fuck i forgot ruby
>>
>>51706124
faggot, not being able to handle PHP
>>
>>51705075
>Gap buffer

Interesting, that's the same solution I was thinking of. Didn't know it had a name.
>>
>>51706143
>I can't handle using a broken language
I can write PHP I'd just rather not?
Fuck off and stop shitposting
>>
File: plebs vs pats dpt.png (56 KB, 839x777) Image search: [Google]
plebs vs pats dpt.png
56 KB, 839x777
v2
>>
most game corporations use C++. I don't know why you faggots try to make your girly languages a thing
>>
>>51706124
I don't think anybody in this day and age learns assembly to write it. It's more for being able to understand what your compiler is spitting out so that you can check to see that optimizations are actually working, etc.
>>
>>51705059
so do I simply change the draw function and it's all good?
>>
>>51706185
>PHP
>C++
>C#
>>
>>51706217
Railed by Ruby
>confirmed
>>
>>51706216
Probably.
>>
what do you guys use to make canvas in C++
>>
>>51706063

>PHP
>>
>>51706272
go use a girly language
>>
any nice programs to share in ideone.com?
>>
>>51706305
http://ideone.com/JXV5fR
>>
>>51706305
>>51702900
>mfw OP is the only D code in the thread
>>
>>51706329
nice
>>
>>51702900
is pic supposed to be making fun of him? why?
>>
>>51706329
now make a program that makes a program that does that for an arbitrary input string
>>
Why is swift the best language?
>>
>>51706363
>http://ideone.com/JXV5fR
brainfuck generated eh?
>>
>>51706399
>implying you can make fun of Andrei's D
>>
PHP haters (the classic) confirmed to be tranny posters
>>
The guy working on sshchan: Are you here? I have a few questions.
>>
>>51706283

Do you also use Pascal grandpa?
>>
File: qt trap.jpg (203 KB, 742x1200) Image search: [Google]
qt trap.jpg
203 KB, 742x1200
>>51706432
whats wrong with trannies?
>>
>>51706465
they look like men
>>
>>51706465
cancer of white-race
>>
>>51706478
(because they are men)
>>
>>51706478
if you wouldn't fuck kalindra chan, you're a fag
>>
>>51706507
/pol/ get him
>>
i just want mariana cordoba down my throat is that so wrong
>>
>>51706509
someone get putin on the phone
>>
>>51706523
based putin- trannies to prison
>>
Should I put return at the end of void functions?
>>
>>51706735
No.
>>
Should I be using geometry shaders for recurring models or does it not matter? It certainly makes things easier to manage but I'm talking from a strictly efficiency point of view.

I'm using OpenGL.
>>
>>51706223
thanks

ill come back later someday and let you know how it werks
>>
>>51706735
Yes.
>>
>>51706771
>recurring models
Do you mean the same thing being drawn many times with only lightweight changes like position? Use instancing for that.
>>
>>51706755
>>51706790
I know I don't need one, but doesn't it look nicer?
>>
>>51706818
No.
>>
>>51706803
How does that compare to geometry shading?
>>
>>51706818
no
>>
>>51706847
Instancing is much faster, and expresses intent better.
>>
>>51706818
Yes.
>>
hmm, guys spot the error
http://ideone.com/sqN5Yf
>>
I want to write an mp3 tagger and my language options are C and Python, is there any reason I would want to use one over the other?
>>
>>51706870
Cool, I'll give it a whirl.
>>
>>51706881
>hmm, guys do my homework
FTFY
>>
>>51706890
C is cool, python is shit
>>
>>51706902
nah, im just playing with code for this guy:
>>51705374
>>
boo > python
>dynamic typing
>ever
Only adhd children prefer dynamic languages
>>
friendly reminder that someone is shilling D so he can profit off his book(s)

the legit thread: >>51704718
>>
>>51706971
>being retarded
>not paying attention to new threads
>ruining the /dpt/ linked list
>>
File: tumblr_nx7j1n8shF1rp8y35o1_1280.jpg (222 KB, 983x1400) Image search: [Google]
tumblr_nx7j1n8shF1rp8y35o1_1280.jpg
222 KB, 983x1400
>>51706223
okay I got a question about something

I'm not having crashes, so it must be right so far, but I am not able to call anything and see it happen.

if I put a print command inside any of the functions inside the prototype table, and call them from C, I don't see anything in the console.

is there a command to show everything on the stack?
>>
I'm new to C and linux

I've got a parent that forks into two children, I want the main to run until the children are done

Right now I have something like:


main()
{
child1 = fork()
if (child1 != 0) child2 = fork()


while(true)
{
if (child1 == 0) do x
if (child2 == 0) do y
if (child1 and child 2 return) break;
}
}




This results in the parent looping forever and the children never doing anything. Is there something I'm missing here?
>>
>>51706971
Bit late on that one chap
>>
>>51706971
you mean like how bjarne shills his C++ books every single /dpt/?
>>
>>51707090

>thread is posted 20 posts pre-bump limit with instructions not to use until bump limit
>isn't used much until bump limit

>newfag can't read, makes new thread 37 posts after bump limit, despite 200+ post thread
>complains other thread isn't close enough to the bump limit
>immediately wants it active
>>
>>51704688
nice. what did you used?
>>
>>51707155

dw it won't hit C++
C++ doesn't do all the work for you
SJWs can't program
>>
>>51707126
>thread is posted 20 posts pre-bump limit
this alone invalidates the thread
>>
>>51707173
^ true
>>
>>51707204
no it doesn't, and it never fucking has
a bunch of dpt threads have been pre-bump limit
get over it
>>
>>51707204
no one cares dude, get over it
>>
Pre-emptive new thread: >>51704718 :^)
>>
>>51707173
that's why guys stick with PHP, C++. The classic. Ruby, Pearl sound like they are made for 10 year old girls.. (also python, on rails)
>>
>>51707248

the thread previous to yours is part of an invalid chain
>>51692784
and also
>>51689664
(that one was also me, ha)
>>
reminder that we live our lives inside of an IO monad
>>
>>51707173
Swift (Taylor Swift)'s also girly
>>
File: 1398208935625.jpg (57 KB, 645x773) Image search: [Google]
1398208935625.jpg
57 KB, 645x773
>>51707262
I will never have a side effect on the world
>>
>>51707261
congratulations faggot well done
>>
>>51707329
thanks, it must be shit caring about the bump limit
>>
>>51707344
kill yourself
>>
>>51707376
it is
>>
File: nftables.png (113 KB, 3088x937) Image search: [Google]
nftables.png
113 KB, 3088x937
Slowly making progress.
I finished link-layer addresses/broadcast and I started working on packet dissection for my network stack tonight.
I'm not sure yet, but I think it's best to have a flat list of all headers like
 [EthernetHeader, IPv4Packet, UDPPacket] 
, instead of a nested design.
Luckily distinguishing between 802.2 LLC and regular 802.3 frames isn't that hard, since EtherType values are all > 1518 (max MTU).
Meanwhile I'm still thinking about the filter subsystem and where to put the handlers.
I'd like to get some feedback, but no one in DPTs before nor anyone IRL thinks it's an interesting project it seems.

Pic related, it's similar to the filter subsystem I want to build.
>>
>>51702900


NEW THREAD
>>51704718
>>
i have to write a compression algorithm and it's 75% done but its just not showing any signs of working and i've been working on it for 2 weeks and it's due tomorrow at 11:59pm and i just want to give up but i can't because i need to get at least a 50% on all programming assignments or i automatically fail the course can you guys help me?
>>
>>51707291
the feels that >>= us.
>>
>>51707596
in haskell, how do you actually use/apply a monad
Thread replies: 255
Thread images: 26

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.