[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 318
Thread images: 32

File: 1477018791066.webm (282KB, 250x432px) Image search: [Google]
1477018791066.webm
282KB, 250x432px
Previous thread: >>57184318

What are you working on, /g/?
>>
Does anyone know why after adding constraints to a button in xcode 7, the said button doesn't work anymore?
>>
i'll make a rule based system database kind of thing
>>
My own implementation of C printf, currently stuck on wide chars I have no idea of how to deal with them outside of using printf itself
>>
post the discord invite link please, maybe I'll manage to use it before it expires this time
>>
>>57190109
what is this disgusting 3D
>>
File: 1477032982479.jpg (320KB, 750x1000px) Image search: [Google]
1477032982479.jpg
320KB, 750x1000px
>>57190193
https://www.youtube.com/watch?v=p2P6kgAeMIY
>>
>tfw you run your program and you get stuck in an infinite loop and you don't know whats wrong
>>
>>57190289
shig

use a debugger if you can't figure it out
>>
File: som visu.jpg (100KB, 1609x905px) Image search: [Google]
som visu.jpg
100KB, 1609x905px
When testing a self organizing map, it's particularly hard to see if it works, when you do not know what the map should actually look like.

This seems odd for once.
>>
>>57190178
is that why /dpt/ is so quiet, y'all faggots on discord these days?
>>
File: bteq.jpg (34KB, 480x360px) Image search: [Google]
bteq.jpg
34KB, 480x360px
>>57190322
my constructor for the som class has 200 LOC.
>>
>>57190392

Yes.
>>
Does someone mind to help a starter (like, started this week) on basic C++?

How do i declare 100 variables called "x1", "x2" ... "x100" in a loop or another succinct way, giving values for each (lets say x1 = 1, x2 = 2, x100 = 100)?
>>
>>57190455
use an array
>>
>>57190455
You make an array of variables !
>>
>>57190455

std::array
>>
File: umaruwp.jpg (112KB, 1920x1080px) Image search: [Google]
umaruwp.jpg
112KB, 1920x1080px
/dpt/-chan, daisuki~

Ask your much beloved programming literate anything (IAMA).

>>57190455
http://www.penguinprogrammer.co.uk/c-beginners-tutorial/variables/

>>57190289
post the code please. Examine the loop exit condition then analyze the variant parameters for each iteration.

>>57190162
Post the code please. Abstraction and separation of concerns could help here, think about a generator.

>>57190109
Please use an anime image next time.
>>
>>57190565

Shut up.
>>
>>57190565
Are you an AI?
>>
Is there any method I can call on a array to get a specific part of it (example, from 0 to 5) without using a for loop in C#?
>>
>>57190239
Where in that is the reaction in OP's pic?
>>
>>57190455
Use lisp use write a loop that writes code declaring the variables then hit that loop's output with an eval lol
>>
>>57190455
Sounds like you want std::array and std::iota
>>
On today's episode of anon doesn't understand relational databases:

How would you go about modeling one-to-many relationships like, say, a character's inventory in an RPG? The first thing that comes to mind, but seems inefficient and naive is: Character kills a monster and an item is generated as loot. This item gets a unique ID, a "belongs to character ID", and a set of stats and is thrown into a gigantic items table. To retrieve a character's item I now have to "SELECT * FROM items WHERE belongsTo=<charID>; Let's just pretend I'm making world of warcraft for a second so there can be millions of items in that table and it'll just keep on growing. That doesn't seem right to me.
>>
>>57190604
right about when he says watergate
maybe after 10:00
>>
anyone know why when I run my program (C) and ir prints something into the terminal the terminal prompt appears on the same line as the thing that was printed?
>>
>>57190585
array.Skip(5).Take(10).ToArray();
Gets you array[5..15].
>>
>>57190604
0:09 in >>57190239

12:35 in https://www.youtube.com/watch?v=JOUFsCS7xYE
>>
>>57190658
Thanks
>>
>>57190650
You need to print \n at the end of your string, it's a special newline character.
>>
>>57190683
aww right completely forgot that thanks
>>
File: sublime_thingy.png (241KB, 1257x737px) Image search: [Google]
sublime_thingy.png
241KB, 1257x737px
Are there any vimtards here?
Is there a plugin to achieve pic related in vim?
If not, is it even possible to write something like that?
>>
>>57190716
They're called minimaps, there's a bunch of them out there like https://github.com/severin-lemaignan/vim-minimap
>>
>>57190716
Why do they always use the same latin pharagraph in everything code-related that showcases text?
>>
>>57190455

Create another program to generate each individual variable, something like this, then copy paste the result into your real program

 


#include <stdio.h>
#include <stdlib.h>

int main (
for ( int i = 0; i < 1000; i++ )
{
printf ("int x%d \n", i);
}
}



:^)
>>
>>57190745
http://www.lipsum.com/

>>57190638
This is how world of warcraft does it.

https://trinitycore.atlassian.net/wiki/display/tc/character_inventory
https://trinitycore.atlassian.net/wiki/display/tc/item_instance

>>57190580
Kinda.
>>
>>57190740
Thanks anon!
>>57190745
Because it's a 'standard' now and you have snippets for it everywhere, so you just have to type `lorem<tab>` which is faster than typing 5 lines of random characters.
>>
File: dpt.webm (1MB, 1280x720px) Image search: [Google]
dpt.webm
1MB, 1280x720px
What you think of my new /dpt/ OP image guys?
>>
>>57190851
>This is how world of warcraft does it.
Interesting. If I understand it correctly that's pretty much what I had in mind. It is just for some private server, I bet the real servers use a different system. I'm sure Trinity serves more users with more items than anything I make ever will though, so it'll probably be fine.
>>
What is the correct way to return from a block of if statements in a function that has a return type?

Version 1
//must have a return statement and else because -wall/-werror
bool Ver1 (void) {

if() {
//each of these if statements do something different, but for the calling function having the do something
//means that it is true
if() {
return true;
}

else if () {
return true;
}

else {
return false;
}
}

else {
return false;
}
}

Version 2
bool Ver2(void) {


if () {

if() {

}

else if () {

}

else {

}

return true; //still the final line executed meaning the function is true
}
else {
return false;
}
}


I am shit at C but want to understand what the conventions are.
>>
File: slav humour.jpg (85KB, 1000x696px) Image search: [Google]
slav humour.jpg
85KB, 1000x696px
Who here has written a booru scraper? Post link pls.
>>
>>57191136
There's no One True Rule(tm). Some languages are opinionated and will tell you to do it one way or the other. Like in Go you're supposed to have a single return true at the end, and then ifs for all the return falses. So (pseudo code)
if some error:
return false
if incorrect parameters:
return false
if can't perform operation:
return false

// everything went well
return true


Other languages/style guides will tell you to try to keep your if statements truthy in most cases. That is, when possible you should check if some condition is true instead of checking if something is false. This makes sense because it's the way your brain is used to thinking of conditionals. "If I have my keys, unlock the door... otherwise retrieve keys".
TL;DR: It depends and you'll develop a sense for what looks cleanest as you practice.
>>
>>57191422
why not ||
>>
>>57190959
Please use an anime image next time.
>>
>>57191136
I prefer returning early because it tells me I can ignore the rest of the function once I read to that point.

That being said, it may be that you're trying to do too much in one function.
>>
Can I get a discord link?
>>
>>57191543
https://discord.gg/bWHZ9
>>
>>57191422
>in Go
do you have a reference for this? my impression was that you were supposed to return as soon as you could
>>
>>57191480
It depends. I mostly use || for conditions that are logically similar, like say...
if USER_ACCESS_LEVEL == 3 || USER_ACCESS_ LEVEL == 4:
return true

return false


This makes perfect sense to me. But throwing a bunch of things into the same if statements just because they end up on the same branch (i.e., we want to return false if the house is blue, if the database hasn't been initialized, if it's the third sunday of the month, if the user's name starts with non-ascii letter etc etc) is generally a bad idea. The most important thing is that code clearly expresses the programmer's intent.
So in my little example above just using || would have been fine probably, but maybe we want to add some specific handling of certain errors in some branches.
>>
>>57191604
>my impression was that you were supposed to return as soon as you could
I believe that is in reference to error handling, i.e. https://en.wikipedia.org/wiki/Fail-fast

Typical go code looks like

SomeMethod() (bool, error) {
result, err := DoSomeQuery()
if err != nil {
return false, err
}

something, err := DoSomethingElse()
if err != nil {
return false, err
}

... etc.

return true, nil
}


The first level of indentation (left-most) is supposed to be the true branch, or the ideal/intended result of the method. So for example a method GetUserFromDatabase() should, in its left-most indented branch, return a user object and no error. I don't really have a reference, I think I saw this in a talk/presentation but it makes a lot of sense with how errors work in go. Here's a thing from the wiki that roughly conforms with what I'm saying:

https://golang.org/doc/effective_go.html#if
>This is an example of a common situation where code must guard against a sequence of error conditions. The code reads well if the successful flow of control runs down the page, eliminating error cases as they arise. Since error cases tend to end in return statements, the resulting code needs no else statements.
>>
>>57191613
>
if USER_ACCESS_LEVEL == 3 || USER_ACCESS_ LEVEL == 4:
return true

return false

hmmm
>>
>>57190455
create a vector<int>
>>
>>57190828
how do I go about doing that?
>>
Codecademy vs Khan Academy vs Team Treehouse vs Freecodecamp vs The Odin Project

What is best for a complete beginner to learn on?
>>
>>57190959
please use anime text 日本国語 next time
>>
File: sicp.jpg (24KB, 350x256px) Image search: [Google]
sicp.jpg
24KB, 350x256px
>>57191913
>>
>>57191944
why is this everywhere?

just a meme or actually needed in 2016 (when there are thousands of other resources)? how come
>>
>java generics doesn't allow you to instantiate an object of type T
thanks orcacle
>>
>>57191913
harvard's cs50 2016 on youtube
>>
How do I access an API from some company in Java?
>>
>>57191422

Ah, understood. Current purpose isn't for error checking/handling but for decisions on user input. We've got memory limitations on these devices.

http://pastebin.com/ks264b7k

Think you get the idea of why I was asking if early returns were going to be good practice or not. Given me something to go look at so thanks.
>>
>>57191913
you want to learn webdev or a more general/computer science oriented course?
>>
>>57192094
Probably something more practical that I could use after learning like webdev?
>>
>>57192010
What is the title of the video?
>>
>>57191913
Learn C, then you can easily pick up any other language, because they are all based off of it.
>>
In C#, when reading a file as a byte array, is there a way to do this?
FILE: BLOCK......<data inbetween>..BLOCK....<more data> to Block[] with something like:
File.Split("BLOCK"); ?
>>
>>57192328
What are you saying?

Are you saying you want to read the file in blocks that are separated by the string "BLOCK"?

Yes, you can do this.
>>
>>57191213
very enjoyable, my friend knows the author actually
:^)
>>
>>57192246
What did the millennial mean by this?
>>
>>57192246
k tard
>>
>>57192149
cs50 2016 playlist
>>
>>57192493
u just got trick'st'r'd lad
>>
>>57191779
monads
>>
>>57192416
Yes, I want to know what's the easiest way to do that. I was reading them manually w/ the offset but for different files (with same size) the alignment is different.
>>
File: tomoko lite uses thinkpaddu2.png (775KB, 1026x1038px) Image search: [Google]
tomoko lite uses thinkpaddu2.png
775KB, 1026x1038px
What's the best text editor and why is it GNU nano?
>>
>>57192505
week 0 scratch, right?
>>
File: 1328954625768.jpg (53KB, 447x604px) Image search: [Google]
1328954625768.jpg
53KB, 447x604px
>learn lisp
>use it for some personal projects, works great as a replacement for ad-hoc scripting languages and handles large-scale projects very well
>sudden desire to program in anything else pretty much vanishes because I see how weird, verbose, and arbitrary other languages are
What the fuck am I supposed to do? I only enjoy programming in one language now, and I find it hard to justify learning another when I can just spend more time either programming in Lisp or just doing other things. This has been going on for about a year now.
>>
>>57190638
> To retrieve a character's item I now have to "SELECT * FROM items WHERE belongsTo=<charID>; Let's just pretend I'm making world of warcraft for a second so there can be millions of items in that table and it'll just keep on growing. That doesn't seem right to me.
Any decent RDBMS will allow you to create an index for the belongsTo column, so that queries don't have to scan the entire table to find matching entries.
>>
>>57192503
>>57192493
>pajeets mad that people don't want to learn java
>nu males mad that people don't care about their latest memescript with the dr.pepper library
>>
working on c# interop with c

c# runtime should have wrapper classes that don't actually contain any data. they instead only operate on the unmanaged data stored by their representative native structures. e.g.

// c
struct entity_tmplt
{
char[MAX_HPATH] filePath;
int maxSpeed;
};

// c#
public class EntityTmplt
{
IntPtr native;

public string FilePath
{
get { // get native value }
set { // set native value }
}

public int MaxSpeed
{
get { // get native value }
set { // set native value }
}
};


but I'm having a hard time figuring out how to make that actually happen. I'm assuming I should have the c# wrapper store an IntPtr to the native struct, but then I can't reliably access the struct's members without manually packing and reading bytes directly. (I can do that as a last resort but I'd rather not.)
>>
>>57190109
That's egghead. He didn't like Trump's calling Hillary corrupt, etc at the Alfred E. Smith Dinner "Trump & Hillary Roast" at the Waldorf Astoria.

What a load of maggots. Especially Maria Fartaroma.
>>
>>57192542
Look for a string.split() function. That will do what you want.
>>
>>57192542
Is the file a text file? Or actual binary?
>>
File: haskell..png (7KB, 397x131px) Image search: [Google]
haskell..png
7KB, 397x131px
>>57192570
>>
>>57192607
A binary
>>
>>57192598
Who was the qt jewess milf sitting one row behind Trumps seat anyways? Asking for a friend
>>
>>57190109
Donald nailed it and called them out
>>
File: 1451373365681.png (4KB, 413x135px) Image search: [Google]
1451373365681.png
4KB, 413x135px
>>57192618
Please use a better image next time
>>
who is the bernie sanders of programming
>>
>>57192597
Such is life in the managed world.
>>
>>57192543
>he is not using notepad.exe
TOP MOTHERFUCKING KEK M8
>>
>>57192693
>notepad
>not cat/type
>>
Today I used logo programming language and I managed to draw a perfect square.
Right now I am wondering why noone ever created some kind of pen up command so I dont have to redraw all the lines to get back to the original spot..
>>
>>57192693
>he doesn't use echo
Lmao why
>>
File: Capture.png (49KB, 1000x1000px) Image search: [Google]
Capture.png
49KB, 1000x1000px
>>57192607
>>
>>57192713
>he doesn't use dd
babby's first ubuntu install
>>
>>57192721
in the first file it's actually D5 BB 08 00, selected it wrong.
>>
>>57192760
>NOT EVEN KNU PLUS LINUX
XD
girlswithlaugtherintheirfaces.tiff
>>
>>57192635
Finance anchor on news with FOX (previously CNN) who worked in restaurants with her immigrant family as a young one. She married a very rich finance man sitting to her left (or your right). Anyway, her tits got the attention of Daily Mail. Her name is Maria Bartiromo, or Fartaroma.

http://www.dailymail.co.uk/news/article-3861172/Maria-Bartiromo-s-dress-steals-Al-Smith-dinner.html
>>
>>57192789
Nah I mean behind Trumps actual seat, where he was sitting during other speeches, the one with black hair.
>>
>>57192580
> Triggered millennial doesn't know about pascal, Fortran, or lisp
>>
>>57192721
eh.. not sure...

You can load the whole file as a byte array, then write a loop to search for occurrences of the "BLOCK" bytes, then split up the array based on that.
>>
>>57192837
>memes
>>
>>57192837
They are dead bruh. Those languages are all dead. Might as well throw COBOL in there.
>>
>>57192867
Fortran isn't written anymore, but is still used. And lisp is still alive.
>>
>>57191550
rreee, it expired again
may I have another chance?
>>
File: Smugbird.gif (1MB, 250x141px) Image search: [Google]
Smugbird.gif
1MB, 250x141px
>>57192789
>Fartaroma
>>
>>57192576
https://www.postgresql.org/docs/9.1/static/sql-createindex.html
Looks like this is what I need.

So my item table would have a foreign key that points back to the character that owns it, then I would index that foreign key column which basically created a mini-table of just the items belonging to that character. Does that sound about right?
>>
>>57192900
https://discord.gg/7ZJPV
>>
>>57192570
>works great as a replacement for ad-hoc scripting languages
how?
>>
>>57192834
This honey? If so, she is a beauty. I like your eye. I don't have a name.
>>
>>57192960
thanks
>>
redpill me on discord
>>
File: stallman caught.jpg (77KB, 857x774px) Image search: [Google]
stallman caught.jpg
77KB, 857x774px
>2016
>still using """free""" software
>>
>>57192960
Yes exactly, why does no one talk about her
>>
>>57193070
because she's an average old woman? when i was watching the replays the first thing i noticed was the woman in the red dress and said wow she is smoking. i didnt think it'd be a news story about her tho
>>
>>57193102
smoking is bad for you
>>
>>57193027
Tencent invested in it.
If you're not paying for the product, you are the product. In most cases at least.
>>
If 4chan didn't exist, what else would you waste your time on?
>>
>>57192597
It's best to have explicit marshalling between the two representations. You don't want to make it easy to do constant back-and-forth wrapping and unwrapping, you want to coerce users (including you) to do it properly.
>>
>>57193126
Movies, series, books and video games.
>>
>>57193126
probably unironically reddit desu senpaitachi
>>
>>57193126
Maybe I'd have a life


jk
>>
Without going to college or university what type of work can I possibly get out of knowing how to write in C#, Java, JS, Python and Ruby?

Do I really need a piece of paper to be able to be hired (In Australia or online)?
>>
>>57193126
Learning how to program instead of shitposting in /dpt/
>>
>>57193166
Web development and enterprise work.
>>
>>57193166
depends. you might get work in a start up if you have a good github portfolio.
>>
>>57193166
You either need a degree, portfolio or connections.
If you have neither you better suck mad dick because you won't get nowhere.
>>
>>57192618
Unfortunately, Haskell is one of the languages I was thinking of when I typed "verbose, and arbitrary". I like the idea of a language with a 2D layout table syntax, but I haven't seen anything in Haskell that would recommend itself to me. I like it's design-by-type philosophy, but I don't like the rest of Haskell.

>>57192954
It has all of the usual benefits of scripting languages without the downsides.

Pros of scripting languages it takes:
>dynamic typing, with optional static typing for if/when your script grows into an actual project
>bar none, the best interpreter environment I've ever used
>easy to go from an itch to scratch to a working script

Cons of scripting language it avoids:
>ad-hoc syntax and comprehensions (Lisps probably have the most consistent syntax I've ever seen in a language)
>weird type-coercion and other dynamic typing problems (is null nil? is nil an error? will calling == give the same result as ===? and more)
>first-class modules and units avoid the weird dependency and namespace problems that can occur
A lot of scripting languages have an "add it in as necessary" design philosophy, until they grow into an "everything and the kitchen sink" language where everything was just kind of tossed in as people needed it without forethought, or into a language that isn't easily extended. Lisps are really well-designed and form a nice, consistent foundation to grow on and avoid a lot of those problems.
>>
>>57193166
There's a difference between being a good software engineer and knowing how to write fizzbuzz in a few meme languages. If you were the former you'd have a great portfolio already.
>>
>>57193191
>You either need a degree, portfolio, connections or vagina.
ftfy
>>
>>57193211
>vagina
Or really wish you had one.
>>
>>57193166
this isn't a perfect test but think about what would make you hire someone. this guy emails you and says he knows some languages. do you give a shit?
>>
>>57193183
>>57193188
Where is a good place to look for such positions in your opinions?
>>
>>57193199
How is Haskell verbose and "arbitrary"?
>>
>>57193233
Job search portals. Job fairs.

Apply for jobs even if they say they require experience. If a programmer sees your github portfolio, it might be enough for them to invite you for an interview.
>>
>>57193191
Not that hard to get a portfolio though in this day and age. Assuming you are actually good at your job.
>>
>>57190604
when trump says "Hillary is so corrupt"
>>
>>57193220
https://github.com/CoralineAda
truly
>>
>>57190109
>What are you working on, /g/?
Finished non-sliding piece move generation, will start on sliding pieces tomorrow.
>>
>>57192556
>Scratch
kek
>>
>>57190959
this shall pass.
>>
>>57193199
>Haskell
>verbose
>arbitrary
>>
Best way to do cross platform(pc, android, ios) with Java?
I remember doing one app with javafx but is there anything better?
>>
>>57193241
More arbitrary than verbose, really. The inherited OCaml-style nested lets get on my nerves though.

Even though Haskell can represent failure as a first-class value, people write libraries that THROW EXCEPTIONS and bring everything relying on it to a halt (e.g., text library).

Even though the community agrees there's an obvious "right way" to handle strings, it's not the way strings are handled in the library. As a result, there are, what, three? different and overlapping string-parsing libraries because they still treat strings as a linked list of Chars. Speaking of, text provides both Strict and Lazy variants which involve totally incompatible types, so if you use one you cannot use the other.

Lazy-by-default was the "Wrong Thing"(tm). It turns out to be less helpful than expected and introduces an incredible amount of difficulty in debugging larger programs. A lot of Haskellers realize this, but there's no effort to change it because it forms such a large part of Haskell evangelizing (wow! infinite data structures!). To avoid this you have to manually wrap anything even performance sensitive or requiring debugging with specific calls for strictness.

Haskell's emphasis on graphical/symbolic operators and functions leaks into the community, where the standard behavior is to define operators as sequence of arbitrarily chosen symbols.
>>
>>57190109
if Trump would win (protip: he won't) these people would have that last face for 4 whole years.
>>
>>57193537
>people write libraries that THROW EXCEPTIONS
their fault

>lazy by default bad
it led to the language's purity, and is very useful
it does have serious problems though

>operators
are good, most aren't arbitrary (look at the relation between >>=, >>, >=>, =>=, =>>)

I don't see how a lisp fan could complain about any of these. There are far worse problems in lisps.
>>
>>57193602
>>>=, >>, >=>, =>=, =>>
Are you meming?
>>
python

dont know how to move the enemy towards the player in a 2d list, I guess in def enemy_ move
I have to figuring out which of the possible squares the enemy can move to is closest to the player, but im a clueless wannabe autist

http://pastebin.com/1yTQjHDZ
>>
>>57193682
the latter two aren't in the standard library (but should be)
>> and >>= are usually subsumed by do notation
>=> is occasionally useful, with Control.Category you can just reuse .
>>
>>57190455
use std::map<std::string,int>
>>
>>57193723

He really wants an array and you're going to suggest a map? Come on.
>>
>>57193746
maps (dictionaries) are the only way to progmatically create a named array with the names changeable at runtime.

map["x1"] = 1
map["x2"] = 3
...
map["x100"] = 100
>>
>>57192927

yep. any dropped items you'll have you can assign to NULL (if your engine permits it) or you can create a system user that holds all dropped items.
>>
>>57193602
>their fault
Text is a standard library in Haskell and it can throw exceptions. This is not just a "community" problem. It is a Haskell problem.

>lazy by default led to the language's purity
It didn't lead to Haskell's purity. Lazy-evaluation is a consequence of purely functional evaluation, by definition it CAN'T lead to purely functional evaluation. Lazy evaluation is also present in Lisps, it's just not a big deal and isn't a point of evangelizing like it is in Haskell. It's just a tool, which is all it should be. It's only "very" useful when representing a very specific subclass of data structures.

>are good, most aren't arbitrary, look at
You listed only 5 out of the hundreds of symbol-combinations that are used in libraries. For example, <*>, <**>, <* and *> in the standard library do not at all reflect what they do visually. There's no way you can actually memorize all of the thousands of combinations you or others can make, but they're still used instead of being reserved for a handful of widely used operations (e.g., sequencing, like the ones you listed).
>>
>>57193829
This. Agda has infinite data structures through codata but it's strict by default. A thunk is just a function, anyways.
>>
>>57193829
>Text is a standard library in Haskell and it can throw exceptions
Do you mean file IO? That's another matter

>It didn't lead to Haskell's purity
Yes it did, laziness and side effects don't go well together. When would side effects in a lazy thunk be done?

>You listed only 5 out of the hundreds of symbol-combinations that are used in libraries. For example, <*>, <**>, <* and *> in the standard library do not at all reflect what they do visually

They are all cleary related though.
How would you visually reflect applicatives?
Names would not fit.

>>57193878
() -> a
a

i prefer the latter
>>
>>57193917
Lazy evaluation should be the uncommon case, not the other way around. Besides, strict evaluation can implement lazy evaluation. Not the other way around.
>>
>>57193933
>Lazy evaluation should be the uncommon case
No, I disagree
>>
>>57193782

Sure, but if it's x1..x100 you know he really doesn't care about the 'names' of each var.
>>
>>57193199
>verbose
map ((+2) . sqrt) [1..90]

vs
(setf ret nil)
(dotimes (i 90)
(cons (+ (sqrt n) 2) ret))
(nreverse ret)
>>
https://android-developers.blogspot.com/2016/06/android-changes-for-ndk-developers.html
>Each ELF file has additional information contained in the section headers. These headers must be present now, because the dynamic linker uses them for sanity checking. Some developers try to strip them in an attempt to obfuscate the binary and prevent reverse engineering. (This doesn’t really help because it is possible to reconstruct the stripped information using widely-available tools.)
>
$ readelf --header libBroken.so | grep 'section headers'
Start of section headers: 0 (bytes into file)
Size of section headers: 0 (bytes)
Number of section headers: 0
$


> -s Remove all symbol table and relocation information from the
executable.

is -s allowed or not? what even is an ELF?
>>
>>57193224

this, actually.

whenever people ask me "am I ready" I tell them:

ok, imagine you have to spend 1500 dollar (+taxes) each month for an employee. the dude has exactly your skills. deal or no deal?
>>
File: 1343198209835.jpg (19KB, 330x411px) Image search: [Google]
1343198209835.jpg
19KB, 330x411px
>>57193917
None of these are against or disprove what I said, you're just saying "Well, I don't mind them so they're not a problem." I think you're taking this as some kind of personal argument or indictment of what language you personally like instead of reviewing actual criticisms of the language, so I'm going to save us both some time and stop responding to you now.
>>
Starting out in C++, what are some recommended ides besides devc++ and code::blocks?
>>
>>57194141
pen and paper
>>
>>57194141
VSCode or no IDE (emacs/vim).
>>
>>57193952
Maybe I'm just more performance-minded but I see no reason for laziness to be anything but an edge case. It's got overhead and it makes performance hard to reason about. And you only gain efficiency when it turns out you never needed to do some fairly large chunk of work in the first place, i.e. you're calling some function that a) isn't parametric in the type of the result of the work, b) doesn't evaluate stuff it's passed, with c) some input that was/is expensive to produce. It seems kind of niche to me.

In an ideal world the only difference would be in the type signature (with the ability to abstract over strict/lazy) and otherwise it would look identical, but if you're going to pick one or the other to be the focus, you should pick strictness because it's very easy to express laziness in terms of strictness. It's impossible to go the other way. Even e.g. Clean does at least part of this by making strictness part of the type instead of making you use ugly shit like "seq" and various functions with ' at the end.

>>57193917
Also,
>Yes it did, laziness and side effects don't go well together. When would side effects in a lazy thunk be done?
Haskell can be lazy because it is pure (as pure as a language with non-termination can be). But it could just as well have been strict, and there are pure strict languages out there.
>>
>>57194141

Just download MSYS2 and Sublime Text. No need for an IDE.
>>
>>57194021
An elf is a creature from European mythology.
>>
>>57194202
>But it could just as well have been strict
It was lazy first, part of the motivation was to have a lazy language.
Laziness actually does have performance benefits - certain kinds of lists become iterators, but obviously has performance costs too.

Imho, laziness better matches what you should expect from a language.
I can't think of a proper way of phrasing "it fits what you want better"


>>57194086
>>>i think xyz are bad
>>i don't think so because abc
>you're just deflecting criticism!

This isn't against and doesn't disprove what I said, you're just saying, "Well, I don't mind it so it's not a problem". I think you're taking this as some kind of personal argument or indictment of what arguments you personally have made instead of reviewing actual rebuttals to the arguments. I'm not going to "save anyone the time of responding", because I'm not a dick.

>Lazy evaluation is bad. You may disagree, but I just KNOW you're wrong on this.

>I don't like the names for applicative operators. They describe operations that haven't really been used before so they should use existing convention.

>I don't like that some libraries use what I've already stated is expliclty acknowledged by Haskell programmers to be bad library writing practice


God forbid we start on the problems lisps have, which subsume the Haskell problems (and alleged) you've enumerated.
>>
>>57194021

Executable and
Linkable
Format

It's the standard for binaries used by Linux, the BSDs, and a few other Unixes.

http://wiki.osdev.org/ELF

Its analog on Windows is PE, or Portable Executable, which you'd probably recognize from the file extensions .exe, .dll, and .sys. On Mac OS X, the standard is Mach-O.
>>
>connection error
save me from this hell
>>
>>57194141
brackets and cmd
>>
>>57194141
https://www.jetbrains.com/clion/
>>
Can someone pass me the discord link? My name is Pajeet Rakesh and I am here on behalf of SunMediaTech Dhelli Ltd.

Please respond.

Kind regards,
Rakesh, Chief Technology Officer for SunMedia Tech Dhelli Ltd.
>>
>>57193987
Why would you do that when you could use the built-in
build-list
function or functional comprehensions?
>>
>>57193917
>How would you visually reflect applicatives?
>Names would not fit.
everywhere outside of haskell this would be a clear indicator that you're abstracting too much.
>>
So I just started learning Java.

I have a pretty good grasp of For and While loops, variables, if/else statements and getting user input. What kind of application should I make to work around these before going forward? Preferably something I can just keep adding on to as I go along.

Also I'm learning Java through use of Notepad and compiling via command prompt. I know I'm fucking myself by not easily seeing syntax errors and the link, but I feel like it simplifies things. Is this not a good idea? Should I really use an IDE?
>>
>>57194267
>i don't think so because abc
>you're just deflecting criticism!
You literally said "No, I disagree" and "i prefer", those literally ARE your personal opinions and preferences. That's fine to have, but I really don't care to argue about opinions. You're welcome to them.

>God forbid we start on the problems lisps have, which subsume the Haskell problems (and alleged) you've enumerated.
You never bothered listing or discussing any, and the only reason you're bringing them up is to defend your own opinion of Haskell with "Well, Lisp also has problems!" Of course it does, having programmed in Lisp for about 2 years now, I'm well aware of them and run into them on a daily basis. Many of them are so deeply ingrained in Lisp that they will never be changed and your only choice is to accept and "prefer" it that way (e.g., Lisp's strict-evaluation-by-default, an emphasis on arbitrary-arity functions over curried mono-arity functions, lowest-common-denominator-style naming of functions not involving lists, etc.). Nobody is "forbidding" you from discussing Lisp problems save for you choosing not to bring them up except for as some kind of weird defense of Haskell's problems.

Anyway, please have a nice afternoon.
>>
>>57194465
Get IntelliJ which is less cancerous than Eclipse or any other Indian-tier editor. Consider getting vim/Emacs when you become more proficient.

Maybe start working with files and make a simple text editor or an agenda.
>>
>>57194465
At the very least use a real editor like VSCode, Emacs, Vim, Sublime, etcetc. You don't have to go full IDE yet if you don't want to. It's probably better if you don't desu, my university's Java 101 course required you don't use an IDE (not really enforceable but still).
>>
>>57194524
how are the intellij guys so good
>>
>>57194465
You're not at the level in which you should be writing any large or consistent application. That comes at intermediate level, which consists of writing something sizeable in a library and dumping it when it becomes a mess, reading a bit of a book and trying again. For now, keep practicing on little applications that test your knowledge quite heavily and learn lots about efficiency and organization. Games like tic tac toe can be written in a surprisingly large amount of ways.
>>
>>57194563
I hate IntelliJ, I have been using Emacs all my life. Actually I don't program in Java, I had to port something to that language, that is why I used that.

But for beginners it is better to use an IDE so you just write code and press F9.
>>
>>57193692
have you tried passing your players move distance into your enemy move function?
>>
>>57194611

>But for beginners...
Beginners should not shy away from the command line. Learning how your application is built is important.
>>
>>57194642
this.

Java's easy as it is in the cmdl anyway. But there are things to know about class files and object files, jars, exes and java files.
>>
>>57194642
That as well. I remember when I started I wrote some C code and changed the extension to .exe wondering why it didn't work.

But with an IDE you get all of those abstracted so he can actually learn the language and have that nice auto completition with Ctrl-Space or Tab or whatever.
>>
#include <stdlib.h>
#include <string.h>

#define ARRAY_LENGTH 50
#define ARRAY_SIZE ARRAY_LENGTH*sizeof(int)
//demonstration of comparable functions with dealing with memory. Verified with assembly output.

int main(int argc, char const *argv[])
{
int x[ARRAY_LENGTH];
int y[ARRAY_LENGTH];
int ret;

/*
slightly different loops, Ada's is more efficient on low optimization
since it doesn't have to store i in memory, according to the standard,
unlike C. With the register keyword, the loops are virtually identical.
On full optimization, loops are identical.
*/
for (int i=0; i<ARRAY_LENGTH; ++i)
x[i] = 1;

//identical in Ada and C
memcpy(x, y, ARRAY_SIZE);

/*
Ada version calls a for loop just like above.
To reliably call memset, you must import it.
Gnat is not checking bit patterns for (others=>V)
to see if it can call memset
*/
memset(y, 0xFF, ARRAY_SIZE);

//Ada version calls memcmp as well
ret = memcmp(x, y, ARRAY_SIZE);

return 0;
}

with Ada.Command_Line; use Ada.Command_Line;
with System;
procedure Memory is
pragma Suppress(All_Checks);
type Int_Array is array (1..50) of Integer;
type Int_Array_Ptr is access all Int_Array;

type Byte is new Integer range 0..255 with Size=>8;
procedure Memset (Dest : in Int_Array_Ptr; Data : in Byte; Amount : in Integer)
with Import, Convention=>C, Link_Name=>"memset";

Y : aliased Int_Array;
X : aliased Int_Array;
Ret : Boolean;

begin -- Memory

Y := (others=>1);

X := Y;

Y := (others=>0);
Memset(Y'Access, 16#FF#, Y'Size / System.Storage_Unit);

Ret := X = Y;

end Memory;
>>
File: 1477095957966.jpg (32KB, 476x476px) Image search: [Google]
1477095957966.jpg
32KB, 476x476px
>>57194194
>>
>>57194141
A small magnet, a hard drive, and a steady hand
>>
File: intelligent-rage-feels.jpg (110KB, 601x601px) Image search: [Google]
intelligent-rage-feels.jpg
110KB, 601x601px
>have to write type expectations for all my functions for current assignment
>want to use currying on a specific function to show off and because it'd be easier
>can't get the expectation syntax to work with currying
THERE'S NO FUCKING INFORMATION IN THE MANUAL ABOUT HOW TO USE EXPECTS WITH CURRIED FUNCTIONS, AND NONE OF THE CURRYING EXAMPLES HAVE EXPECTS WRITTEN FOR THEM. HAVE YOU FORSAKEN ME CINNAMEG????
>>
>>57194722
>not butterfly
>>
>>57194766
there's an emacs command for that
>>
>>57190716
why would you even want to do vim? you have a vim mode for sublime anyway.. it's not like sublime is bloat
>>
>What are you working on, /g/?
Trying to make a 4chan theme that at least somewhat resembles a terminal.

I might just make a 4chan browser for the terminal 2bh. Dunno what'd I do with the captcha
>>
File: 1360691694602.jpg (5KB, 250x163px) Image search: [Google]
1360691694602.jpg
5KB, 250x163px
>>57194768
>mfw there actually is
>>
>>57194682

You can still learn the fucking language while learning the compiler.

>>57194710

>since it doesn't have to store i in memory, according to the standard, unlike C
The C standard does not require local variables to be stored in memory unless you are taking their address. Compilers are free to put whichever variables they wish into registers.
>>
>>57194874
I was under the impression every variable in c needed an address. Gcc was just writing to the memory location is all I meant by that.
>>
>Cobol programmer.
>mfw when the xml file I want to work with has no tree structure(parent-child relation) and I have to read the file sequentially instead. Writing the values in a sequential file and then to recreate the xml file by reading the sequential file...

I don't know whats worse. Us using COBOL or the fact that some idiots generates xml files with no tree structure?
>>
>>57194960
>some idiots generates xml files with no tree structure
you mean he doesn't generate xml?
>>
>>57194991
i think he means the tree is maximally deep
>>
>>57194542
nano is perfectly serviceable
>>
File: 1469730523810.jpg (19KB, 350x263px) Image search: [Google]
1469730523810.jpg
19KB, 350x263px
>messing around on Tinder
>trying to reverse engineer it to improve my iOS app that I'm working on
>see ex of 4 years that I'm far from getting over from
>die a little inside
Help me I don't want to feel that feel
>>
>>57192938
FUCKING CIA NIGGERS STOP MAKE THE INVITE LAST 24 HRS
>>
>>57195175
same thing happened to me a couple months ago, except we only broke up 2 years ago. she was so pure and innocent when i knew her and it sucks knowing she's getting facials and dp'd by random chads on tinder.
>>
>>57195207
The fact that the girl I was/am in love with is not as pure and innocent as I thought she was is soul crushing, I feel you
>>
>>57194778
>Dunno what'd I do with the captcha
how do other console 4chan browsers handle it?
>>
File: textboard.png (38KB, 831x822px) Image search: [Google]
textboard.png
38KB, 831x822px
Working on my textboard (that will eventually become an imageboard). Just got greentext/post-linking to work. The code behind it is fairly bad in Big O terms, but it doesn't seem to be affecting load times at all.
>>
>>57195289
>pony
Neat
>>
>>57195315
All the other links are working boards, the pony link just redirects you to this awesome new rick astley meme.
>>
>>57194524
>Java
>not using an IDE

Sure thing, guy.
>>
>>57194991
It is xml but (even though there are relationships between several elements) the elements are all in the same level.

Eg.
<root>
<4chan></4chan>
<b></b>
<pol></pol>
</root>

Visually xml.
Technically, something else.
>>
>>57195359
Writing beginner programming without an IDE should be encouraged, no matter the language. IDEs are not required and often go to teach poor practices and not foster understanding for the relationship between files, variables, classes and objects. IDEs should only be considered a necessity for your sanity when programming something of substantial size, especially in a language such as Java.
>>
File: device-2016-10-23-010753.png (928KB, 1080x1920px) Image search: [Google]
device-2016-10-23-010753.png
928KB, 1080x1920px
Just started with Android development, first project is a widget for my smarthome system. I define a config on my central server, and the widget display the corresponding data in a fitting UI element. The widget only needs a read and writekey to work, which is pretty neat.

The picture shows: button (top left, click sends request to server), boolean state (bottom left, blue => on, grey => off), text data (right). I probably should make them look more different, but it's fine for now.

They can also let the use set values on the server if specified in the config on the server.
>>
>>57195579

That's my point, though. You're pretty much always going to be using Java from an IDE. It's not like you graduate to emacs or something, at least not without a serious autocomplete setup.
>>
File: plot.png (166KB, 2000x2000px) Image search: [Google]
plot.png
166KB, 2000x2000px
/dpt/-chan, how could you explain this?

>Source: https://gist.github.com/anonymous/3f929e66314f669c89b45b0d282b203e
>>
>>57195705
The daily programming thread is almost widely considered terrible due to the fact that it's mostly populated by beginners, and semi-intermediates who like to deride beginners.

Nothing even remotely interesting gets discussed here.

Webdev general is widely the same, except it's of slightly better quality.
>>
>>57195705
Go back to your OOP hell you stupid retard.
It's that way because /wdg/ is retarded.
>>
>>57195705

What's there to explain?
>>
>>57195705
>advice, faggot
>>
>>57195705
wish /wdg/ wasn't so dead

every /wdg/ regular is also a regular here though
the reverse cannot be said
>>
(defun comb (stk x)
(let (
(fst (first stk))
(snd (second stk)))

(cond
((or (eq '+ x) (eq '/ x)
(eq '- x) (eq '* x))
(cons (funcall x snd fst) (nthcdr 2 stk)))

((or (eq 'log x) (eq 'sqrt x))
(cons (funcall x fst) (rest stk)))

(t (cons x stk))
)))

(defun rpn-eval (expr)
(car (reduce #'comb expr :initial-value nil)))
>>
>>57195741
Are you here because you're unable to find the right place or to bully beginners?
>>
>>57195865
Bully beginners.

>>57194141
>devc++
>code::blocks
you're fucked from the start m8
>>
>>57195863
((((This) does) trigger) me)
>>
>>57195911
Would you mind biological death?
>>
>>57195863
ah yes the descriptive variable name "stk"
>>
>>57195863
>>57195942
don't forget the clarity of "comb", and the lack of type annotation makes it even easier to figure out what the fuck this is
>>
>>57195942
>>57195952
comb = combinator
stk = stack
standard names
its like not knowing people use i and j as temp iteration variables

>>57195911
not an argument
>>
>>57195972
how on earth is a rpn interpreter a combinator
and would it kill you to call it "stack"
>>
>>57195987
would you rather I name it foo?
comb is appropriate because the function combines parts of the input into one output, depending on circumstances

and it its a stack because I push and pop some elements, although not formally
>>
>>57196008
>because the function combines parts of the input into one output
like every other function with multiple parameters?

>A combinator is a higher-order function that uses only function application and earlier defined combinators to define a result from its arguments.
it's not a fucking combinator
>>
>>57194268
which gcc flag strips the section headers tho? -s or something else?
>>
>>57196023
>hurrdurr semantics
and yes, by your own def, it is a combinator

>uses func application = funcall ..
>earlier defined combinators = + * log sqrt
>defina a result from its args
does exactly that
>>
>>57194465
use the latest version of eclipse, not friggen notepad
>>
>>57196056
oh i didn't realize that s-expressions were church-encoded mr. pedantic
>>
>>57196023
>durr I don't know lisp can return multiple values
>>
Can I do these types of if statements in C?

if (x >=0 && x <= 31 && y >= 0 && y <= 9)

The goal here is that I have a (x,y) grid that ranges from 0,0 in the top left, out to 80,40 in the bottom right.

What I want is an exclusion area from 0,0 to 30,8. Is this the right way to write that sort of 'between' exclusion in C?
>>
>>57196119
bool
rng (n, s, e)
{ if (s <= n && e >= n)
return true;
else
return false;
}
>>
>>57194937

Doing proper register allocation isn't the cheapest operation, so compilers often avoid doing so when not told to optimize. Even just using -O2 should force it to be a little smarter.

>>57195359

This quarter, my AI class has been using Java for the homework assignments, and I've pretty much just been using Sublime Text, CMake, and a terminal.
>>
File: 1452471092796.png (372KB, 1280x720px) Image search: [Google]
1452471092796.png
372KB, 1280x720px
>>57196151
>Implicit int
>That style
>
if (cond)
return true;
else
return false;
>>
>>57196164
>>>57194937 (You)
>Doing proper register allocation isn't the cheapest operation, so compilers often avoid doing so when not told to optimize. Even just using -O2 should force it to be a little smarter.

I know, that's what was shown.
>>
>>57196033

-s strips debug, symbol, and relocation information
-S tells the compiler to emit an assembly file, rather than a binary

Case is important, so know the difference.

(I used to confuse these two rather often. I don't know if others do).
>>
>>57196175
t. faggot who likes code related
bool rng (int n, int s, int e) {
return (cond) ? true : false
}
>>
>>57196201
>Still using a ternary statement
>>
>>57196201
return cond;
>>
>>57196217
>tfw used to be practically married to ternary until i started using rust
it's been a wild ride man
>>
>>57195705
what does TF-IDF map? why are there sometimes 2 words?
>>
>>57190109

not working on anything at the moment, but starting a 1 year programming contract with American Express in a few days, should be fun.
>>
>>57196164
>my AI class has been using Java for the homework assignments

John McCarthy is rolling in his fucking grave.
>>
>>57196379
I think the two words are occurring at the same frequency
>>
File: plot.png (199KB, 2000x2000px) Image search: [Google]
plot.png
199KB, 2000x2000px
>>57196379
TF-idf is term frequency * the inverse document frequency.
It's used to filter meaningless words like "to", "a", "the", etc...
>https://en.wikipedia.org/wiki/Tf%E2%80%93idf

Sometimes,two words are displayed because the data-set is small and lots of entries have similar coords. I've done that to prevent overlapping.

>See pic related for 4 instead of 2
>>
>>57196408
norvig is big on python for ai
>>
/g/, what companies actively check for 80 characters limit in their programs?
Is that something I should care about these days?
>>
>>57196550
Retarded corps do. You shouldn't worry about the trash though
>>
>>57196408

We held a vote in class on what language to use. The choices were between C, C++, Java, and Python. We were asked to order the languages by preference, so I assume an instant runoff voting system was in place. The class apparently prefers Java, with C in second place. I voted my preferences as C++, C, Python, Java, if I remember correctly.

If it weren't for the fact that what is going to be graded is the java source files, I would consider using Clojure to target the JVM, especially considering that the second assignment is going to involve some genetic algorithms.
>>
>>57193692
AWESOME GAME ANON! .......
>>
>>57196550
Yes, I want to be able to use a large font on only half my 2560x1440 screen.
>>
>>57195863
damn I just love tediously opening and closing parenthesis
>>
do you think my professor would be unhappy if i did my project in his pet language by creating a program within it written in another language, running it, and the reading the result and forwarding it?
>>
>>57196550

100-120 is probably more reasonable, these days.
>>
>>57195289
ayyyy that's pretty good lookin
>>
>>57196943
if only there were editors that matched parenthesis or something
>>
https://github.com/thalesmello/webcomplete.vim

How would I go about implementing web completion in Linux?
>>
>>57197064
I think if you should implement an interpretter for brainfuck in his language and write it in that. Interpretters for brainfuck are easy. Writing it in brainfuck may be hard though.
>>
>>57197255
this

100 should be enough. I do hate it when I split screen on vim and can't see the whole fucking line.
>>
File: 1455484754303.png (302KB, 400x403px) Image search: [Google]
1455484754303.png
302KB, 400x403px
Are there any tutorial sites you guys recommend for Ruby on Rails?
>>
I know this is probably really basic, but can anyone tell me why my linked list keeps getting this error whenever I add a node using the headInsert function?

>Warning: assignment makes pointer from integer without a cast [enabled by default]

http://pastebin.com/dfMy7m49
>>
>>57190109
I'm learning python and I want to make a tool to encrypt and decrypt data using multiple ciphers, but I also want to be able to do it by hand - what are some good hand ciphers that'll be easy to do in python?
>>
>>57198139

Hartl's book is good.
>>
>>57190638
yup that's how you do it
>>
>>57198313
Thanks!
>>
>>57198357

No problem. It's what I'm using to learn rails for a project.

Covers a lot of stuff.
>>
>>57198232
gimme a line number
>>
>>57198405
26 and 32

I think i just figured it out. I changed the function from int to nodePtr and the error went away.
>>
>C++
Building a word ladder generator between 2 evenly lengthed strings
>>
>>57198483
Do the scripts have execution permissions?
>>
>>57198652
i set the script, the folder with the text file, and the text file itself to the magic 7's and it worked. it didn't work until i did the text file as well though. which is weird. it was a fun puzzle though. every time i look up the answers i'm that close and am missing something like that. one time i thought something was a directory and didn't understand it was a text file without an extension and i ended up googling it when i did 99.999% of the work already. so never googling it again
>>
Why does dirtycow require you to write to the mapped file via /proc/self/mem instead of just writing to it directly?
>>
Pleb here. I want to write a python script that downloads a .csv file from this NASA site:

http://exoplanetarchive.ipac.caltech.edu/cgi-bin/TblView/nph-tblView?app=ExoTbls&config=planets

It's turning out to be much harder than I expected. Normally you'd hover over "Download Table", and then the menu would popup, from which you'd click "Download Table". It then opens a new tab and downloads automatically it from there.

In the past, most scrapers I wrote just had direct links to to the files so it was straightforward using bs4 and requests. I'm feeling pretty lost with this though.
>>
>Always have vertex attrib 0 array enabled
What does this mean?
I saw it in some guidelines for WebGL programming.
>>
hello i am drunk and ready to argue. Go is going to take over by 2020
>>
File: help.png (6KB, 114x100px) Image search: [Google]
help.png
6KB, 114x100px
>>57199398
based
god pike will definitely have given us generics by then
>>
>>57199439
I understand that open source isn't the best metric to gauge a languages popularity, but most of the trending repositories on github are in Go.
>>
I have a problem with language hopping so right now I am dong C# and something seems just not good to me, and I really hate it, I guess I was too used to C but dont get me wrong I like the OOP approach as well. I was wondering if I should just stick with C# or learn something else, and actually STICK to learning it. So recommendations ?
>>
https://blog.valerieaurora.org/2016/10/22/why-i-wont-be-attending-systems-we-love/
>>
>>57199677
>valerieaurora
I'm not clicking on some special snowflake whore's blog. At least have the decency to archive your link before posting it here.
>>
>>57199677
These people use words like "safety", "afraid", and "scared" as if they're literally scared for their life just because someone is going to talk down to them.

How the fuck do these people function?
Are they autistic?
>>
>>57199636

What don't you like about C#?
>>
>>57194474
>You literally said "No, I disagree" and "i prefer", those literally ARE your personal opinions and preferences. That's fine to have, but I really don't care to argue about opinions. You're welcome to them.
>I don't care to argue about opinions

Then don't give me your fucking opinions, bitch at me when I disagree and then say "waaah not an argument"

Your complaint about strictness "shouldn't be the norm" wasn't a fact. It wasn't backed up by anything.

The same for your complains about the applicative operators. What SHOULD they have been called? You give no alternative
>>
>>57199700
It is just too human friendly, like I am writing plain english, honestly makes me feel dumb.
>>
>>57199734

That's about the stupidest thing I've ever heard, and I watched Clinton's comedy routine at the Al Smith memorial dinner.
>>
>>57199753
I'm not him, and I don't really know anything about Microsoft® Java™, but don't you agree that languages like Visual Basic and Pascal-derived languages look pretty stupid?
Especially Ada. What I fucking shitty language.
>>
>>57199776
You have shit taste
>>
>>57199776
I think you look pretty stupid, so there.
>>
>>57199753
Idk it is like liking a manual car over automatic I guess.
>>
>>57199776

I actually really like Ada.
>>
>>57199873
>it's like liking riding a bike over using training wheels
>>
Working on a programming problem for my C class.

How would I find and count the frequencies of words in an output?

Example input:
src
src
img
src
img
iframe


output would be:
src 3
img 2
iframe 1
>>
>>57199954
*from an input.
>>
>>57199954
you mean in an input?
>>
>>57199973
>>57199971

yes
>>
>>57199954
The "lazy" way:
Have an array of encountered words and number of times encountered.

The "good" way:
Have a trie of encountered words with the number of times encounter at each node.
>>
>>57200018
>Have a trie
Why O(input_length) when you can O(1)? I.e. use a hashmap.
>>
>>57200051
memory issues
>>
>>57200051
>i.e. use a hashmap
A hashmap would be another completely valid solution but:
- You have to store all of the strings in hashmap buckets, which also makes collisions more expensive to compute.
- A trie is collision-free
- Strings which are sub-strings of larger strings ("the" -> "there") are stored for free.
- You get lexicographical ordering for free.
- Easier to implement well.
- No hashtable/hashfunction recalculations when the table grows a lot.
But which would be better would rely on the input data and the quality of the implementation.
>>
>>57198739
Anyone? Or am I just asking in the wrong place?
>>
>>57200106
>Strings which are sub-strings of larger strings ("the" -> "there") are stored for free.

"Free" in the socialism sense, perhaps -- you're just using allocated space that would be otherwise wasted. No matter what, each trie node is going to store that data.
>>
daily tip: coding isn't the same as programming
>>
File: 1472899502363.jpg (14KB, 290x385px) Image search: [Google]
1472899502363.jpg
14KB, 290x385px
Lads. I've decided to stop wasting my life away in bed all day and learn a skill that might help me find a job.

What programming language & which book(s) should I investigate? Assuming I dedicated all my time to it, how long would it take to get good enough at programming to get a job?

Cheers brahs.
>>
>>57190959
I like it.Would have been funnier with gloves on.
>>
>>57199954
Here's my simple html parser I am working on. It assumes valid html tags have src attribute. Retarded assignment I know. I will post functions next.

int main() {
FILE *fp;
char buf[BUFSIZ], url[100], command[200];
char *html_string = malloc(256 * 1000);
char user_input[100];

puts("URL:");
fgets(url, 100, stdin);

strcat(command, "curl -s ");
strcat(command, url);

fp = popen(command, "r");

while (fgets(buf, BUFSIZ, fp) != NULL)
strcat(html_string, buf);

puts("Ready");

while(TRUE) {
fgets(user_input, 100, stdin);

switch (user_input[0]) {
default:
puts("Unknown command: Enter c, t, or u to parse HTML. Press q to quit.");
puts("Ready");
break;
case 'c':
get_count(html_string);
puts("Ready");
break;
case 't':
get_tags(html_string);
puts("Ready");
break;
case 'u':
get_urls(html_string);
puts("Ready");
break;
case 'f':
puts("Extra credit functionality not built out yet. Please try another command.");
puts("Ready");
break;
case 'q':
puts("Complete");
goto exit_loop;
break;
}
}
exit_loop:;

pclose(fp);
free(html_string);

return 0;
}
>>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

#define TRUE 1
#define FALSE 0
#define newline() puts("")

void get_freq(char *html) {

}

//count all valid html tags with src=" check if space is before src
void get_count(char *html) {
int count = 0;
char *tmp = html;
while ((tmp = strstr(tmp, "src=\"")) != NULL) {
if(isspace(*(tmp-1))) { count++; }
tmp++;
}
printf("%d\n", count);
}

//print all tags containing src=""
void get_tags(char *html) {
char *tmp = html;
char *p1;
while ((tmp = strstr(tmp, "src=\"")) != NULL) {
if(isspace(*(tmp-1))) {
p1 = tmp;
while(*p1 != '<') {
p1--;
}
p1 = p1+1; //p1 starts with < so add 1 to get beginning of tag
while(!isspace(*p1)) {
printf("%c", *p1);
p1++;
}
newline();
tmp++;
}
else tmp++;
}
}

void get_urls(char *html) {

char *tmp = html;
char *p1;
while ((tmp = strstr(tmp, "src=\"")) != NULL) {
if(isspace(*(tmp-1))) {
p1 = tmp+5; //starts at src=" so add 5 to be inside quotes
while(strncmp(p1, "\"", 1) != 0) {
printf("%c", *p1);
p1++;
}
newline();
tmp++;
}
else
tmp++;
}
}
>>
New thread:
>>57200190
>>57200190
>>57200190
>>
>>57200134
Read SICP, nah but if you want to find a job your best off learing babby programming with LAMP stack or .NET stuff. SICP is cool if you want to learn theory, but I would learn it after you get a job. Learn how to read and implement shit using API's
Thread posts: 318
Thread images: 32


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.