[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: 23
File: K&R himegoto waifux2.png (1 MB, 1000x1400) Image search: [Google]
K&R himegoto waifux2.png
1 MB, 1000x1400
old thread: >>55139968

What are you working on, /g/?
>>
>>55145572
This is what I'm listening to
https://www.youtube.com/watch?v=QyW66e23X50
>>
Thank you for using an anime image.

Was programming a mistake?
>>
What is your favorite text editor /dpt/?
https://www.strawpoll.me/10508463

Alrighty /dpt/, I'm going to keep this poll going for about one or two more threads so I can have a large pool of votes and get a good idea on what /dpt/ likes to use.
>>
File: akari a cute.gif (880 KB, 500x281) Image search: [Google]
akari a cute.gif
880 KB, 500x281
Why aren't you using the C programming language to write all your applications?
>>
>>55145630
I'm busy learning 6502 assembly.
>>
>>55145630
C doesn't even have negative or fraction types
>>
>>55145630
I'm pretty disgusted by lesbian 2D.
Too many disturbing real life flashbacks.
>>
>>55145572
Hello fellow D programmers
>>
>>55145663
Usually you don't implement the entire thing in OpenGL. What you're looking for sounds like a 3D engine example which uses thinly wrapped OpenGL or something. Because you'd have to define the world inside a fragment shader or something. And that's pretty much only convenient using raymarching (which is cool, you can do that). But it's not common. I wouldn't know where you'd find that.

Are you doing >>55145036?
>rendermonkey/fx-composer
>>
>>55145630

Because Scheme exists.
>>
>>55145709
No dude, 3D lesbians like all homos are disgusting degenerates, but 2D lesbians are cute.
>>
The temptation to use C++ is high.
>>
is there an ftp somewhere with programming books
>>
>>55145761
What's holding you back?
>>
>>55145767
http://books.installgentoo.com/
account:install
pw:parakeet

But why you would go there instead of bookzz.org is beyond me.
>>
Hey /dpt/, Why does
shell.SendKeys("^V{ENTER}")
open a menu in firefox and some other programs?
(paste, enter)
>>
File: IMG_20160618_183811.jpg (49 KB, 530x523) Image search: [Google]
IMG_20160618_183811.jpg
49 KB, 530x523
I only come here for the anime memes
>pic related
>>
>>55146439

Go to /pol/ if you want anime memes.
>>
>>55146439
You've come to the right place.
>>
>>55146473
Thanks for the tip
Based Ruby
>>
File: lal.png (237 KB, 286x347) Image search: [Google]
lal.png
237 KB, 286x347
I'm learning to program with C, how long until I am as good as my mate Pajeet.
>>
Should I use XML to store scene data for a text adventure engine?
>>
>>55146610
Pajeet doesn't know C though. He only works with Java and C#.
>>
>>55145630
I'm in it for the money, so I mostly use languages that are in demand like java and c#
>>
>>55145756
daily scheme thread when?
>>55146623
s expressions or json would probably be better although if it's for a game I'd just use some binary format
>>
>>55146623
>Should I use XML ...?
I can tell you that the answer is almost always 'no'.
>>
Feel free to correct me if im wrong on this but python is a scripting language right?
>>
>>55146623
Write your own format if you don't want others to be able to edit it well.
>>
>>55146629
So the answer is never unless I learn those languages. Gosh darn.
>>
>>55146723
https://en.wikipedia.org/wiki/Scripting_language
I'd say partially. It can do more than just scripts.
>>
>>55146723
Yes
>>
>>55146623
Despite people saying no, this is a pretty good use case for XML. A ton of parsers for XML already exist and you want your text adventure files to be easily editable without special tools.

>>55146739
Obscuring the structure of the files your program uses just annoys people, it hasn't ever stopped someone from creating 3rd party editing tools.
>>
>>55145572
Goddamn those shoulders
>>
File: 1390157510536.png (518 KB, 763x992) Image search: [Google]
1390157510536.png
518 KB, 763x992
Wanted you guys opinion.
I am modeling a database that I have 2 tables, one for stock items and other for sales and I am pretty sure I should have a relationship between them. Should it be a many to many (for both items/sales and sales/items) or should it be many to many (item/sales) and one to many (sales to items)?
Please be gentle.
>>
>>55146700
Closed minded.

XML is lovely at times, a user can crack it open and just "change something", save it and it "just works".

If you know XPath or XSLT and have a transformer available then XML is turing complete and it's AMAZING.

Most people are use to fucking around with XML as a config file.
>>
/g/entoomen, I need some ideas

Just lost my job web deving (company collapsed). What should I develop to make some cash short term?
Web systems I was working on used ASPX and CSS with either VB.NET or C# backend, using SQL for database shit.
Also know C and C++ from college days, but probably more than a little rusty now.
>>
So I have (C++)std::string that is

"m:.word1,9,12"

How can I seperate out the string to put into my list like this, or add it to a map? everything before the ':' is a variable so it could me "ne:.word" or "bubble:.word"

vector.push_back(1); //by parsing 1 from the string
vector.push_back(9); //by parsing 9 from the string
vector.push_back(12);


I'm just having alot of trouble trying to parse out these integer values. Basically my only idea if delete everything before the first integer "m:.word" and then use the , as a token position to get substr of each variable but even that's a bit weird for me to get.
>>
>>55146623
no
yaml

xml is a thing of the past familia
>>
>>55146954
>then XML is turing complete and it's AMAZING
I've used XML as some port of fake programming language and it's fucking god awful.
Only early 2000's JavaDweebs could possibly think that's a good idea.

There are so many other, better markup languages out there. I don't know why you would restrict yourself to one of the most retarded.
>>
are there ANY text editors which don't freeze up when you load 50 mb of text onto them?
>>
>>55147136
Country?
>>
>>55147264
nano
vim
>>
>>55147268
Scotland
>>
>>55147254
I'm sure a markup language being used as a programming language would be fucking awful.

Have you use XSLT / XPath?

Other markup languages just dont stand up to XML when you consider that XSLT and XPath exist.
>>
>>55147283
that's a no for vim

I'll try nano I suppose
>>
>>55147283
vim's large file handling is crap
>>
>>55147244
yaml is shit

>>55146623
xml is shit

>>55146700
correct

>>55146674
Json is SHIT
Go with sexpr or bin

>>55146723
There are no scripting languages

>>55146849
>>55146866
Retards
>>
>>55145572

I took 1.5 years of C++ in college and I want to transition to C# so I can use Unity. I already know Javascript from working as a web developer, so C# would be the largest barrier in my way. Where should I start?
>>
>>55147310
edgy as fuck, calm down
>>
>>55147264
Emacs
>>
>>55147264
vim
>>
>>55147319
Look at the C# language reference on the MSDN.
Download Visual Studio Express.
Make a hello world.
Read docs.
>>
>>55147328
See >>55147307
>>
Er det mulig å lære Idris?
>>
>>55147300
>Have you use XSLT / XPath?
XSLT was part of what I had to do. It was shit as well.
>>
>>55147345
It's not.
>>
>>55147319
Get out of here monkey.

>>55147337
Don't help each other pajeets, you will just fuck everything up.
>>
>>55147349

Nej.
>>
>>55146941
You have two tables, and you write one number to each table.
Then you read it into each direction.
For example:
stock 1:n sales
Means: a stock has many sales, and a sale has one stock.
That's how you read it.
Honestly English isn't my native language so I'm not sure what a stock is.
>>
>>55146723
you can use it as one
>>
>>55147352
XSLT is _the_ shit. It makes working with XML awesome. There's so much you can do with it.
>>
>>55147300
>XSLT
xD https://github.com/eevee/project-euler/blob/master/heteroglot/014.xsl
>>
>>55147300
If you want to use a programming language with your markup language lisp always exists.
>>
>>55147375
:(

Jeg liker ikke JavaScript
>>
>>55145572
is there a good resource that's just algorithms, and how to use them.

I don't want to go through any theoretical fluff, I'm just looking to study for tech interviews.

Also anybody ever do algorithmic trading or quantitative research for a hedge fund?
>>
>>55147400
Iteration with templates, you're a kinky one aren't you.
>>
>>55147390
No can can seriously like XSLT, I assume you're being ironic.
>>
>>55145630
because I graduated.
>>
>>55147453
https://www.amazon.com/gp/aw/d/0262033844
>>
>>55147337

I think downloading the Unity creation kit automatically installed some version of Visual Studio onto my system, so that should be fine. I'll definitely check out the MSDN too, thanks.

Will I ever need a paid version of Visual Studio? Are any of its features meaningful in any way?
>>
>>55145572
still working on dcbljack dot tv, I'm about ready to throw in the towel on it though and move on to something else. I fell for the MEAN meme and I'm ready to get off the ride.
>>
>>55145572
s-stop trying to make me gay /g/, i don't want those feelings
>>
>>55147471
Pretty obvioius not what I mean basically this

Random Algorithm:

print(x)

Used when trying to print x
>>
>>55147455
I'll explain.

So you know how all the games that are made with some `real` language like C++ and some engine. Then later they bolt on Lua as the scripting language for the UI.

Well... when you're in the `enterprise` all you really care about is the database and document generation. So you build you system in Java / C# and it's got Oracle / SqlServer and all the documents get output as XML. The scripting language you bolt on so that your techie users can get anything done is XSLT.

XSLT is amazing in this environment because you can just bolt the transform step onto the end of your document generation and tell your enterprise customers to work it out themselves... or they will pay you services money to fix it for them.

So yeah, literally _any_ scripting language is more fun to use than XSLT.

But... in the enterprise we don't like to have people running Python interpreters or Lisp or Perl or Brainfuck or anytihng.

XSLT is really limiting (part of why I like it) which makes it really easy to stop users shooting themselves in the foot.

... but it's not limiting to the point of stopping you actually getting work done. It's turing complete. There's _one_ good way to do everything which limits the amount of fucking around people can do.
>>
>>55147476
It's probably Build + Publish features that require a paid up version of VS.
>>
English isn't my main language too but, as far as I know, a stock is basically what the items that a store, for example, have to sell. Your post made me realise that I might want to have a stock table. So I would have a 1:N relationship between my stock and items tables and a N:N relationship between the items and sales table. How does it sound?
>>
>>55147494
Fuck off mate, either learn things properly or don't get a job in the technology sector.
>>
>>55147494
Jeg forstår ikke.
>>
>>55147494
You wanted to learn about algorithms, I pointed you to the algorithms book.
>>
>>55147565
I know algorithms, I want to use it for review instead of going through an entire book.

>>55147539
I already have a job in the technology sector trash
>>
>>55147453
Any interviewer with their salt will ask you about 'theoretical fluff'. Nobody cares if you can regurgitate quicksort if you don't understand how it works and what its benefits and drawbacks are.
>>
>>55147589
It's a good book for review too.
>>
>>55147589
>I know algorithims
>I beg on internet forums for algorithm cheat sheets

pick one faggot, the book you've been linked to is the closest thing to what you're asking for that you'll get.
>>
>>55147522
I would honestly rather write VBA macros than have to use god awful XSLT ever again, it's almost on the verge of being a deliberately esoteric/obfuscated language for how verbose it is.
>>
>>55147635
https://www.w3.org/TR/xslt
https://www.w3.org/TR/xpath

I had to glance over the specs to "get it".
>>
File: bungie jumping.jpg (83 KB, 1280x720) Image search: [Google]
bungie jumping.jpg
83 KB, 1280x720
>>55146941
Look up AdventureWorks as example database. There you will find an example how to implement stock and sales in database.
Basically you need tables containing items, stock and sales tables. Items should be connected 1:N to stock and sales.
>>
>>55147698
I will take a look anon, thanks for pointing me a direction.
>>
>>55146739
Or SQLite with sqlcipher extension.
>>
Trying to make a temperature converter that will make Celsius into Fahrenheit but when I put in
lblFahrenheit= CStr((CDbl(txtCelsius.Text) + 32) * 1.8)
I get an error when converting.
>>
>>55148101
Du må skrive det på norsk.
>>
>>55148101
What's the Exception?
What's the value of txtCelsius.Text
>>
>>55148128
Nein, er muss das in Deutsch schreiben. Norwegisch Schwein.
>>
>>55148101
lblFarenheit.Text = CStr(...)

You can't assign a String to a Label.
>>
>>55148138
whatever the user enters in.
>>
>>55148144
Tyskland er full av griser. Takk, mamma Merkel!
>>
>>55148138
I get 'file not found' when I try to run it.
>>
>>55148217
Bitte schoen
>>
>>55148254
Vi har fjell og fjorder, du har kebab og voldtektsmenn.
>>
>>55148305
Wirklich wohne ich nicht in Deutschland B). Ich bin Amerikaner.
>>
>>55148233
Then the offending line isn't the one you mention.
>>
>Decide to write a chat client in C to simmultaneously train using crypto, socket, db and thread libraries
>End up spending hours writing a summary of why I'm *not* using certain constructs so I don't forget why I made some apparently strange choices in my code

why is everything in C implementation defined
I have made a terrible mistake
>>
>>55148376
chat client and server*
>>
>>55148376
post your summary.
>>
>>55148359
Beklager, min feil. Du har meksikanere og trigglypuff.
>>
File: code.png (5 KB, 476x182) Image search: [Google]
code.png
5 KB, 476x182
If I don't have the return statement, the code gets stuck, looping forever. Why does it do that?
The size of inventory is 10.
>>
>>55148394
no, I don't want to be mocked by kids on /dpt/ whose only purpose in life is to deride others
>>
>>55148453
Du bor bruke et mer moderne programmeringsspråk som Rust eller Haskell.
>>
>>55148445
Du hast FREEDOM versaeumt.
>>
>>55148477
>Rust
>Haskell

memes transcend language barriers
>>
>>55148376
>why is everything in C implementation defined
It helps make the language more portable.
>>
>>55145572
Has anyone here tried using ML to organize their porn?
>>
>>55145572
I'm attempting to learn how overload the assignment operator while working with vector like objects. kill me.
>>
>>55148492
Friheten til å bli skutt av politiet, og betale en million kroner i sykehus regninger.
>>
File: 1464835867447.png (185 KB, 367x358) Image search: [Google]
1464835867447.png
185 KB, 367x358
>>55148536
>organizing your viruses instead of uninstalling them
>>
>>55148512
De er fine språk.
>>
Things you can store in 1.8 GBs:

600 five minute MP3 files
4 copies of Windows 98 ISOs
2 copies of each episode of Yuru Yuri S1 highly compressed
6000 different pornographic images
6000 copies of the same pornographic image
300 copies of the /prog/ archives
2 copies of a text file listing all the IPv4 addresses

-OR-
1 installation of Haskell with the batteries included.
>>
>>55148569
>6000 copies of the same pornographic image
Now we are talking[i]![/i]
>>
>>55148557
>Friheten til å bli skutt av politiet
Aber bin ich nicht Neger
>>
>>55148451
If only there was some way you could step through the program and see what it was doing...
>>
>>55148512
They're both great languages.
Don't just dismiss them.
Everyone was afraid of switching from BASIC to C as well.
>>
>>55148583
Is there?
>>
What is the best way to exchange data from a desktop application to a mobile application, using C#? I'm at a loss, don't know what to do.
>>
>>55148524
You'd think so, but no, that's absolutely not the case. I'd rather have my program not compile at all than "compile" but produce different results because a function I used has different behaviour on another platform.

>>55148592
they're both great *memes (that's a pointer to memes, in case you didn't know)
>>
>>55148579
Du har frihet til å ha penger stjålet av politiet.
>>
>>55148600
compile with -g and use gdb
>>
>>55148592
Haskell is basically the new ruby.
Nobody uses ruby anymore, btw.
>>
>>55148600
Ja
>>
>>55148625
Sie haben nicht mein Geld gestohlen
>>
>>55148631
>>55148619
TOLD
>>
File: 1434960468946.png (605 KB, 2363x1866) Image search: [Google]
1434960468946.png
605 KB, 2363x1866
>>55148649
>>
>>55148656
You haven't stolen my gold, Jew.
>>
>>55148619
>You'd think so, but no, that's absolutely not the case. I'd rather have my program not compile at all than "compile" but produce different results because a function I used has different behaviour on another platform.
These two sentences are irrelevant to each other.
>>
>>55148619
I didn't say it makes your code more portable, I said it make the language itself more portable.
Are you being butt-blasted over the size of integer types or something?
>>
>>55148656
Nein, ich kann mein Deutsch ueben and Norwegisch lernen :3
>>
>>55148453
It's okay if you do not want help, but it is not okay to go and spread your ignorance around.
>>
>>55148669
No they aren't. If a function's behaviour is implementation defined, then it can generate different results on different implementations when called in the same way.

>>55148686
How does it make the language more portable? What does "portable" even mean in the context of a language? What the fuck are you on?

No, I'm not buttblasted about the size of integer types, I'm buttblasted about standard-defined functions having implementation-defined behaviour and needing to use POSIX libraries to do anything remotely useful in C.
>>
>>55148686
>I said it make the language itself more portable.

Which is like saying: "We are lazy faggots and we don't care if your code breaks on every other platform". Truly an horrible language.
>>
>>55148667
>han skriver på engelsk
>han er ikke svart
Velg en
>>
>>55148706
What ignorance?

I don't need help, I already figured out what I needed after spending hours searching. I'm just complaining.
>>
>>55148714
>No they aren't. If a function's behaviour is implementation defined, then it can generate different results on different implementations when called in the same way.
Yes however it has absolutely nothing to do with "It helps make the language more portable.".

Anyhow, could you point one of the functions that you have in mind?
>>
File: Screenshot_2016-06-18_20-43-50.png (8 KB, 343x115) Image search: [Google]
Screenshot_2016-06-18_20-43-50.png
8 KB, 343x115
>>55148727
Das war nicht mich
>>
>>55148717
>an horrible
>>
>>55148714
>How does it make the language more portable?
It allows the language to run efficiently on more architectures and implementations. An implementation can use something which makes sense for their platform, instead of trying to emulate some other crap.
Integer sizes are the most obvious example, where C can easily run on non-8bit addressed computers, while many other "modern" languages can not. It extends to far more than just this though.

>I'm buttblasted about standard-defined functions having implementation-defined behaviour
What specifically? Ignoring locale-related and maybe some floating point-related shit, I can't really think of much.
>>
>>55148737
>It helps make the language more portable
The only two reasonable interpretations for this sentence are "It helps make programs written in the language more portable" and "It helps the language be supported on more platforms". Neither of these is achieved by having implementation defined behaviour in the language standard.

>Anyhow, could you point one of the functions that you have in mind?
Sure, just check the clusterfuck that is the majority of the signal family of functions (of which only signal is standard).
>>
>>55148774
>of which only signal is standard
There are 6 standard signals though:
SIGABRT
SIGFPE
SIGILL
SIGINT
SIGSEGV
SIGTERM
>>
>>55148751
Det er bra, fordi engelsk er et stygt språk. En blanding av fransk og tysk. En kjoter.
>>
getchar/getc/fgetc
putchar/putc/fputc
puts/fputs
setbuf
tmpnam
printf/fprintf/sprintf/snprintf/vprintf/vfprintf/vsprintf/vsnprintf
any function about wchar_t
strtok
scanf/fscanf/sscanf/snscanf/vscanf/vfscanf/vsscanf/vsnscanf
atof/atoi/atol/atoll
perror

Were they on drugs?
>>
>>55148774
>Neither of these is achieved by having implementation defined behaviour in the language standard.

It helps the language to sort of run "almost the same" on a lot of computer platforms. Remember, every in Unix and C land is sort of handwavy and duct taped together. This was not that big of a problem in the 70's, when programs where text oriented and quite small. C is a makeshift language and well past its sell by date.
>>
>>55148769
>It allows the language to run efficiently on more architectures and implementations. An implementation can use something which makes sense for their platform, instead of trying to emulate some other crap.
>Integer sizes are the most obvious example, where C can easily run on non-8bit addressed computers, while many other "modern" languages can not. It extends to far more than just this though.

I'm not going to get into the huge argument that this would eventually lead into. I hope it suffices to say that:
- There aren't those many non-8bit-multiple addressed CPUs
- If you're writing a program for a non-8bit-multiple addressed CPU, you're probably not writing it to be portable anyway
- Maybe instead of fucking up the standard for everyone, they should just make a sane standard for the XXI century and let "weird" implementations break it anyway (which they're probably already doing)

Your arguments are fallacious and regurgitated from StackOverflow.
>>
>>55148821
>tysk
Not quite, English is Germanic, but on a different branch than German. Frenchfags did ruin everything for us though.
>Normans were a mistake
>>
>>55148809
I was referring to the functions of the signal family, not to the signals themselves.

>>55148840
But the problem is exactly that. Running "almost the same" is a huge potential source of bugs. An awfully huge potential source of bugs. I'd rather have my compiler outright reject 10% of my program than have 10% of my program silently being a possible source of bugs.
>>
>>55148833
back then you didn't have space to write the fullname (or needed too anyway)

look at haskell
>>
>>55148887
>I was referring to the functions of the signal family, not to the signals themselves.
What family of functions?
>>
I'm writing basically a "report" system in python, gui and all. I have a MariaDB/MySQL server hosted somewhere else, and all I need this python program to do is add new records, edit old ones, and view all records for a specific UID.

My question is, how do I make a separate login page with Tkinter and one for the actual functions? Like the login page just has two labels and two entries and a "login button", then I'd like it to close upon successful login and open a new window which actually displays potential functions.

How do I make it do this? Specifically close and open a new one? StackOverflow told me to have both of them but the login button "hides" the original screen and then the actual function screen gets unhidden. There's gotta be a better way though, right?
>>
>>55148887
>Running "almost the same" is a huge potential source of bugs.

Of course it is, but it is also the reason why C is so popular.
What's harder? To make a systems' language that ensures that every program runs correctly on every platform or to make a systems' language that kind of works for most people RIGHT NOW and then sets computing back in the dark ages?
>>
>>55148774
>Neither of these is achieved by having implementation defined behaviour in the language standard.
Except you are wrong.

>of which only signal is standard
This has nothing to do with implementation defined behaviour. It has to do with other standards adding more, try again.
>>
>>55148847
>- There aren't those many non-8bit-multiple addressed CPUs
And?

>- If you're writing a program for a non-8bit-multiple addressed CPU, you're probably not writing it to be portable anyway
1: You are wrong
2: I do not think this is relevant to the topic.

>- Maybe instead of fucking up the standard for everyone, they should just make a sane standard for the XXI century and let "weird" implementations break it anyway (which they're probably already doing)
Let's also standarise the w32api, right???
>>
>>55148887
>Running "almost the same" is a huge potential source of bugs
It is exactly the same if you follow the standard (you still have not mentioned any of the implementation defined shit you had in mind)
>>
ITT C cucks trying to defend their abominable language with jewish sophistry
>>
>>55149302
>>>/pol/
>>
File: 1440877716898.jpg (37 KB, 598x467) Image search: [Google]
1440877716898.jpg
37 KB, 598x467
>>55149302
xD
>>
What's the best way to go about reverse engineering a huge obfuscated js file?
>>
>>55149462
Suicide
>>
>>55149462
And that huge obfuscated js file is your life?
>>
I know this isn't the right thread but what does /g/ recommend to read if I want to lean [spoiler]networking?[/spoiler]
>>
>>55145572
Just finished working on a way to compile Cython to an executable on my computer.
>>
Recommendations for a linux-compatible Java IDE? I'd prefer something with a balance of features and lightness of weight, if such a thing exists.

yeah i know,
>java
but the world is not the place we want it to be.
>>
>>55150164
https://www.jetbrains.com/idea/#chooseYourEdition
>>
>>55150164
>>55150177
Actually IntelliJ is likely to be in your distro's repository already
But that's what I rec
>>
>>55150164
Emacs

There is always Eclipse and Netbeans however.

>>55150187
Not in Debian.
>>
>>55150187
Thanks, this one looks like a great option. It doesn't seem to be in the Fedora repos, but I'll see if I can get it working from the tarball they provide.
>>
Is it better practice to initialize certain variables outside of nested loops so that it won't be initialized n amount of times in the loops?
For example:
method()
{
for (blah)
{
for (blah)
{
while (blah)
{
int a do stuff
int b does stuff
}
}
}
}


vs.

method()
{
int a, b;
for (blah)
{
for (blah)
{
while (blah)
{
a do stuff
b does stuff
}
}
}
}
>>
>>55150305
In principle, yes. However, 1) the cost of stack allocation and deallocation is very small; and 2) your compiler will almost certainly optimise it for you. So do whatever you think is more readable.
>>
File: image.png (369 KB, 626x885) Image search: [Google]
image.png
369 KB, 626x885
how do I average 2 ints in C?
>>
>>55150322
Cool, I didn't think it was that big of a deal, but it's nice to hear the reasoning. Thank you.
>>
File: 1444581827812.png (277 KB, 850x1251) Image search: [Google]
1444581827812.png
277 KB, 850x1251
>>55150329
unsigned int average = (a / 2) + (b / 2) + (a & b & 1);
>>
>>55148940
:( nobody?
>>
>>55150389
Just create the main window after successfull login?
I don't do Tkinter, but I guess that's one way.
>>
just finished making my library somewhat nice to use, although I still feel like the documentation is very much lacking. maybe I should focus on making a whole tutorial rather than just writing tiny examples and throwing comments throughout the source code.
>>
Abandoned Java for being shit now using C# which is way nicer.

Started learning C++(thenewboston, is this yt good for learning?, also programming knowledge is abs shit a german guy with a pajeeth accent does the show) and I bought a book for it.

I use qt creator for c++ and visual studio.
>>
>>55150548
>is this yt good for learning?
no
>>
>>55150551
> browsing stackoverload and its buddies are no better

The book I found is very good but outdated. Book is from around the 80's but it is good.(It is a non-English book so I won't tell the name)
>>
>>55150576
This is like... pre-standard C++. Just go get the book from the creator.

Why do you want to learn C++ anyway? Especially considering that you already know C#.

And why the hell do you use windows?
>>
>>55150588
Friend started a project where we create a social something app for group projects and we are using C++ for it.

Visual Studio I think the most comfy IDE I have ever used and it would be hard to lose it so I use it inside a Virtual Machine.

The book I told about is from the uni (ELTE).

QtCreator is similar and it is actually pretty good.
>>
>>55150329
add them and divide by two dumbass
>>
>>55150642
QtCreator is very fine indeed.

As for the book I really suggest you check http://www.stroustrup.com/4th.html
>>
>>55145630
Because I'm using Racket, you silly.
>>
Lua is a pretty cool language.
>>
>>55145640
Anon me too
>>
>>55146322
Are you talking VBS
>>
>entire postgres db is ~1GB
>writing DAL in java
>trying to load entire data set in memory
>~11GB
ffs
>>
c++ member pointer things are neat
class foo { public:
foo(int i):i{i}{};
void print() { std::cout << i << '\n'; }
int i;
}
int main() {
foo f(4)
void(foo::* fn)() = &foo::print;
(f.*fn)();
}
>>
>>55150361
Why is tsukudani norio such a tease?
>>
>>55150964
Jesus christ, what the fuck?
>>
>>55150845
>ruby fucks up regex, has no list comp, and cant take comma-seperated array/string indexes or backwards ranges
>perl has no list comp, backwards ranges, or string indexes and doesn't auto-convert ranges to arrays
>coffeescript has no backtick-enclosed shell commands (or shell commands at all), string-reversing, comma-separated array/string indexes, or threading, and is so fucking ambiguous

is there any scripting language that has it all
>>
>>55151014
oh, also
>python fucks up regex even worse than ruby, has no anon functions, no comma-separated array indexes or tilde-enclosed shell commands
>>
>>55151014
>scripting language
There are no scripting languages,
>>
File: my_computer_cant_freeze.png (586 KB, 1028x1500) Image search: [Google]
my_computer_cant_freeze.png
586 KB, 1028x1500
>>55150322
Is stack allocation of arrays also very small? Much smaller than malloc?
>>
>>55151002
its pretty ugly. you can use std::mem_fn instead though which is a bit nicer.

auto f = foo(4);
auto fn = std::mem_fn(&foo::print);
fn(f);
>>
>>55148451
Is inventory a vector?
>>
>>55148451
>If I don't have the return statement, the code gets stuck, looping forever. Why does it do that?
>The size of inventory is 10.
What programming language is that
>>55148451
>>
Ask your favorite programming literate anything.
>>
>>55151156
I would but she's not here
>>
>>55150955
forgive my ignorance, but what sort of dataset are you loading into memory that is taking up 11GB?
>>
>>55148451
Looks like java (though it could be some variant of C or frankly any number of languages).
Evaluate inventory.size(). It may be slightly different than what you are expecting it to be (an integer).

It may be that whatever optimization logic your IDE is using may be tripping over itself (though this seems fairly trivial).

Also, the return statement there is interrupting the for loop and two if statements to exit the class/subroutine/function and may prove to be inefficient, depending on the frequency that this logic is being called that may or may not be relevant.

Lastly, why don't you have a comparative in your first if statement? Depending on the language and IDE if inv is a boolean the logic may work but that could potentially cause some oddities (like always being true every time it checks it even if inv evaluates as false).
>>
>>55151281
well they are ~4.6M rows x35 fields and take 1GB on disk, yet 11GB in ram when loaded by java.
>>
>>55151327
Looks like C++.
>>
>>55148569
>-OR-
>1 installation of Haskell with the batteries included.
What the fuck are you talking about?
>>
>>55145572
Cute girl, but what does she have to do with programming?
>>
Why haven't you rewritten your logging aggregator in Golang yet? Do you enjoy dedicating a whole server just to that task? Do you really think your shitty scripting language deserves all of these glorious cores?
>>
>>55151517
She is holding a C language programing book.

Please tell me you aren't going to complain about the fact it is a cute girl with loose ties to programing.
>>
>>55151517
>>55151554
>Girl
It's degenerate "draw a girl, call it a boy" trapshit.
>>
>>55148602
Probably with a fucking TCP connection. Ever heard of it?
>>
File: clojure.png (16 KB, 250x189) Image search: [Google]
clojure.png
16 KB, 250x189
I'm learning Clojure: the retardation of Java combined with the autism of Lisp.

Ask me anything.
>>
>>55151567
>what is artistic license?
>>
>>55151547
show the code you gigantic pussy
>>
>>55151570
>learning clojure
If you want to use lisp with jvm use kawa scheme.
>>
>>55150493
Nice blog post fucking twat. Make the fucking tutorial.
>>
>>55151588
>artistic
https://youtu.be/ioMspoSNgmw?t=2m55s
>>
Do they drug test programmers
>>
>>55151680
Only menial and government (i.e., menial) jobs drug test.

Good luck
>>
>>55151680
wow, my brain parsed that wrong. I read that as
do they (drug) (test programmers)
>>
>>55151597
>learn a superset of an autistic language made by freetards over the much more popular and better-supported language used by people with actual jobs
>>
>>55151680
Not usually, but many places perform drug tests when you are hired and maintain the right require you to perform a drug test with no notice.

Having done programing while sick and on meds, I really can't recommend it.

Logic stoped working in my head and I hard coded everything. Then I could remember what it was I was trying to achieve and went and took a nap (I was already at home). Then when I came down off the meds and wasn't sick anymore I had to scrap hundreds of lines of code because it was useless.
>>
>>55151737
wtf were you sick with, that you had to take mind-altering medication?
>>
Why is there no web browser that was designed with Unix-philosophy?
program to manage the session
program to fetch the page
program execute the js
program to handle windowing

Instead we have monolithic piles of shit with botnet included
>>
>>55151063
Allocating on the stack requires nothing but decreasing the stack pointer (which is always in a register). Stack memory is fast.
Also, >>55150305 I'm not 100% sure on this, but I'm pretty sure all local variables in a function (regardless of where they're defined in the C code) are going to be initialized in the beginning of the function anyway.
>>
>>55151845
>designed with Unix-philosoph
Computers don't work that way.
>>
Anyone have any suggestions for a project I could do to start learning Rust? I'm already experienced in programming, so I'm looking for something at least somewhat substantial.
>>
>>55150322
>stack allocation and deallocation
>>55151063
>stack allocation of arrays
no such thing in C
>>55151853
>pretty sure
not by a long shot
>>
>>55151845

Because that would be relatively inefficient for something that is rather resource intensive.
>>
>>55151903
>not by a long shot

Can you elaborate on this? I don't ever remember seeing a disassembly where all local variables aren't done by a "sub esp, 0xSize" (Size being of course whatever the needed size is).
>>
>>55151794
>>>55151737 (You)
>wtf were you sick with, that you had to take mind-altering medication?
I had a sever nasal infection that migrated to my ear.

I was on a decongestant (Sudafed) to relieve the blockage, a prescription anti-biotic to fight the infection, and a painkiller (nothing hard like morphine but it was more potent than over the counter) for the ear ache caused by the buildup of fluid.

The Sudafed alone got me high as a kite. The painkiller and, to a less extent, the anti-biotic were just the proverbial icing on the cake of my 'elevated' state.
>>
>>55151990
>>>55151794
>>>>55151737 (You) (You)
>>wtf were you sick with, that you had to take mind-altering medication?
>I had a sever nasal infection that migrated to my ear.
>I was on a decongestant (Sudafed) to relieve the blockage, a prescription anti-biotic to fight the infection, and a painkiller (nothing hard like morphine but it was more potent than over the counter) for the ear ache caused by the buildup of fluid.
>The Sudafed alone got me high as a kite. The painkiller and, to a less extent, the anti-biotic were just the proverbial icing on the cake of my 'elevated' state.
>I had a sever
>sever
*severe
God damn it man stop this bullshit. It is too late to be trying to make coherent thoughts.
>>
>>55151976
first, "sub esp, 0xSize" is not C
second, initialization has a defined meaning in C
third, entertaining your delusion that "C == x86 asm", automatic variables can also be placed in registers
>>
>>55152035
yeah -- I am enjoying the repeated (You)s, but it seems like you need some rest, friend
>>
>>55152067
I agree that "automatic lifetime" != "stack allocated" and people need to be careful how they think of it, but I feel that you're being a little bit too pedantic for this conversation.
>>
>>55151845
Because Unix philosophy is shit.
>>
>>55151458
Haskell is 1.8 GB big duh.
>>
>>55152067
I meant that what's written in C code is somewhat "irrelevant" as in the end it gets compiled to the platform's assembly (didn't mean to insinuate that it's always x86), but you're right on the variables that exist in registers only though, didn't think of that. My original point was that local variables on the stack are created in the beginning of the function (even if they're declared somewhere else in C and assuming they're not inside a register).
>>
>>55152239
>local variables on the stack are created in the beginning of the function
not necessarily https://godbolt.org/g/tcsnp7
>>
>>55152207
No it isn't. Haskell is a programming language, not something you can install. That's like saying C++ is 0.3GB big.
>>
>>55151845
Make one
>>
>>55152424
'Haskell' has become synonymous with 'GHC'.
>>
>>55152424
>That's like saying C++ is 0.3GB big.
More like saying perl is xGB big.
>>
>>55145572
what is the best book for learning Qt?

Should I just read the api docs like a man?
>>
>>55152735
>api docs
yes; there's no up-to-date book for qt; there's an online book/tutorial for qml though: https://qmlbook.github.io/
>>
>>55152735

Yes.
>>
How does Ruby implement
yield
?
Is it source code inline / copy ?
>>
>>55153150
Probably continuations.
>>
>>55153150
Monads.
>>
>>55153150
Describe what it does
From what I've seen it just looks like a higher order function
>>
>>55152758
>>55152761
Not the guy you are replying to. Out of sheer curiosity I went to the qt documentation page just know and where the hell would someone start? This stuff is what I fear the most a bunch of classes, libraries, namespaces and paradoxically you are supposed to know what your are searching before you even find it. Same stuff happened to me when I was doing a bit of work in java. How do I word this right, if you are not aware that there exists a module/class/library that does what you want, you are not even gonna search for it since, you know, you are not aware it exists.
>>
File: why_c_is_shit.png (154 KB, 1354x347) Image search: [Google]
why_c_is_shit.png
154 KB, 1354x347
C is a shit language. Prove me wrong.
>protip: you can't
>>
>>55153610
Oh look, it's that "argument" of absolutely no substance again.
Thread replies: 255
Thread images: 23

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.