[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: 329
Thread images: 30

File: karen haskell.png (818KB, 1280x719px) Image search: [Google]
karen haskell.png
818KB, 1280x719px
What are you working on, /g/?


Previous Thread: >>58068337
>>
First for Java is shit.
>>
>>58076261
Second for AOP
>>
>>58076261
It was an OP image for /fpt/, baka.
>>
File: erlang otp2.png (369KB, 2700x1800px) Image search: [Google]
erlang otp2.png
369KB, 2700x1800px
Erlang > Haskell, stop using that meme language
>>
>>58076278

And /fpt/ is kill now. Try again later, when there's more than 2 people on /g/ who use functional programming.
>>
File: image.png (152KB, 1680x1050px) Image search: [Google]
image.png
152KB, 1680x1050px
>>58076261
>What are you working on, /g/?

Exploring the deepest, darkest corners of Racket by doing Advent of Code 2016.

>>58076261
Thank you for using an anime image.
>>
>>58076295
This.
>>
File: shot-20151206-1874-1jbezwi.jpg (144KB, 1280x1466px) Image search: [Google]
shot-20151206-1874-1jbezwi.jpg
144KB, 1280x1466px
>>58076295
http://lfe.io/
https://en.wikipedia.org/wiki/LFE_(programming_language)
>>
>>58076347
Sign me up
>>
I was told to create "my own class library", for a very specific task.

What would be a good style to do it? Create a folder of its own, with classes? Something else to consider?
>>
>>58076377
make it header only
>>
>>58076394

what does that mean?
>>
File: asuka9.jpg (51KB, 500x768px) Image search: [Google]
asuka9.jpg
51KB, 500x768px
>>58076347
desu it looks messier than pure erlang
>>
>>58076402
it means you put all the code in a single (header) file
this way if someone else wants to use your library they only need to include one file into their project
>>
Another thread on functional programming:

>>58076404
>>
>>58076418

mkay. i thought the style convention is to have a file for every class, but that sounds reasonable.
>>
Ok, fuck...
AGAIN.

We are STILL getting errors!

This wxWidgets is making me lose my fucking mind!

But hell, we're down to only 1 error!
Maybe someone can help with this last one and get me up and running?

Please? It's been 5 hours since I did my LAST (4th) rebuild of this fucking library...
||=== Build: Debug in testHello (compiler: GNU GCC Compiler) ===|
ld.exe||cannot find -lwxmsw30u|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 5 second(s)) ===|


JUST THAT (hopefully)
What do I need to do to get THAT to work?
>>
>>58076460
>le omg how do i link a library?!?!?!?!
What the hell are they teaching kids these days.
>>
>>58076460
you're asking it to look for a library called wxmsw30u
but it can't be found
make sure it exists and is in a folder which you have told it to include
>>
>>58076460

This means that there is no libwxmsw30u anywhere in the linker's search path. You need to find the WxWidgets library files (should have a file extension of .a, .so, or .dll), and copy them into whatever folder ld is searching from. Alternatively, you need to use the -L option to tell ld to add a directory to its search path.
>>
File: anal beads.png (36KB, 127x1792px) Image search: [Google]
anal beads.png
36KB, 127x1792px
>>
>>58076538
>/dpt/ - My Personal Google
>>
>>58076517
There are almost 7500 files in this library....

but...
>>58076522
>>58076538
I did just notice something here....
This file does not in fact exist at all. But there is one called:
lwxmsw31u.a
How do I make it STOP searching for 30u and start searching for 31u?
>>
>>58076590
you have this setting somewhere in your IDE
>-lwxmsw30u
change it to
>-lwxmsw31u
>>
File: beautiful_code.png (348KB, 570x738px) Image search: [Google]
beautiful_code.png
348KB, 570x738px
>>58076557
lmao
>>
>>58076590

Use the -lwxmsw31u flag instead.

And for fuck's sake, run man gcc or man ld before asking stupid questions.
>>
File: output_edge.jpg (390KB, 1582x800px) Image search: [Google]
output_edge.jpg
390KB, 1582x800px
>>58076261
I'm building a collection of basic image filters in C.

Everything works fine, but I was wondering if there's a better way than a basic double for loop to iterate through all the pixels.
>>
>>58076669
I don't know the answer but I'm wondering how you loop through the pixels?
>>
>>58076694
>how you loop through the pixels?
Nested for loop (height, width). You get the RGB values for that pixel.

Then, for each pixel, you take its neighbors by a kernel and you add those values to the original pixel.

Each filters has it's own kernel, so basically the kernel for a intense blur is :
int    kernel[5*5] = {
0, 0, 1, 0, 0,
0, 1, 1, 1, 0,
1, 1, 1, 1, 1,
0, 1, 1, 1, 0,
0, 0, 1, 0, 0
};


http://www.roborealm.com/help/Convolution.php
>>
>>58076749
thanks buddy
>>
>>58076749
Shouldn't you be using more than one thread for something like this?
>>
>>58076601
Ok, I found it finally. Apparently, it was under the project itself and not the global compiler/linker settings...

so, now it searches for the right thing, but it gives me like 50 errors saying a ton of stuff is an undefined reference.

||=== Build: Debug in testHello (compiler: GNU GCC Compiler) ===|
U:\Programming\Tests\Random\testHello\testHelloMain.cpp||In constructor 'testHelloDialog::testHelloDialog(wxDialog*, const wxString&)':|
U:\Programming\Tests\Random\testHello\testHelloMain.cpp|62|warning: 'wxFont::wxFont(int, int, int, int, bool, const wxString&, wxFontEncoding)' is deprecated (declared at A:\wxWidgets-3.1.0\include/wx/msw/font.h:114): use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants ie: wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD [-Wdeprecated-declarations]|
obj\Debug\testHelloApp.o||In function `WinMain@16':|
U:\Programming\Tests\Random\testHello\testHelloApp.cpp|21|undefined reference to `_imp___Z7wxEntryP11HINSTANCE__S0_Pci'|
obj\Debug\testHelloApp.o||In function `Z11wxCreateAppv':|
U:\Programming\Tests\Random\testHello\testHelloApp.cpp|21|
[AND MANY MORE]


>>58076617
I'm on Windows, sadly. I can't man shit.


So... any ideas on this? Why does it say all of these are undefined?

I'm including the libraries. But, even when I comment out the libraries, it shows the exact same number of errors... As if including the big include file doesn't mean shit...
>>
>>58076849
you posted only one warning, warnings do not prevent compilation
you need to post the error(s)
>>
>>58076849
oh, nevermind there was an undefined reference error in there too
that means it couldn't find a function in any of the included libraries
I think you're in over your head here
>>
>>58076806
I don't know. The basic implementation that I have, takes around 2 seconds to render the edges detection in >>58076669

Then I ran to improve the clarity of a giant bmp map, (350MB). It took 2 minutes. I'll try with more than one thread to see.
>>
>>58076295
They have two different purposes.
>>
>>58076908
I just want this fucking library to work, man...
It contains almost 7.5 THOUSAND files, and even something like just including the global include file thing they made gives me errors as fuck...

fuck...

Is there another cross-platform GUI widget library I can try?
Or, do you know of any good sites to check up on making semi-transparent widget things using purely OpenGL or SDL?
>>
>>58077039
Why are you using C++ for this?
>>
File: Screenshot_2016-12-19_17-05-10.png (176KB, 1365x745px) Image search: [Google]
Screenshot_2016-12-19_17-05-10.png
176KB, 1365x745px
Inline post expansion.
>>
>>58077050
What else would I use..?

I know:
-Web Markup
-PHP
-JS/jQ
-C/C++
-Java
-VB/VBA (which I hate)
-SQL (MySQL and Oracle)

(among a few scripting and other languages like Bash, Rainmeter, AutoHotKey, some PowerShell, and some Batch)

I can't think of what else I'd use. And I'd prefer to use C/++ anyway. It's the best language... as long as the fucking libraries work, which is much more often my problem than anything else...
(I'm better with handling the code than the tools used to build the code)
>>
>>58077126
What are you trying to do?

What is the end-goal of your project?
>>
>>58077134
I really just wanted to make some gadgets to run on my desktop atm...

Things LIKE Rainmeter that I can port to BSD when I get a new machine
>>
What C library should I get if I want to utilize GPIO on a Pi 3?
>>
>>58077168
Would this fit your needs?
https://github.com/brndnmtthws/conky

Although I never had any issues with wxwidgets on any of the platforms I used it on (FreeBSD, Windows, MacOS). I'm not sure what's going on with your project.
>>
>>58077239
I had considered this.

It won't run on Windows, though, so I can't get any practice with it, atm.

On the other hand, I'm gonna go back to some other things atm. I can't keep bothering with this right now.

Besides an unrelated problem just came up, and I am fucking losing my shit.
Thanks, though, bookmarked
>>
>>58077307
Test in a VM ontop of Windows.
>>
C with gcc extensions or C with clang extensions?
>>
>>58077320
clang c > gnu c
>>
Should i focus more on C or C++, lads?
>>
>>58076347
This is topical.
https://youtu.be/rRbY3TMUcgQ
(and mildly amusing for a wide range of people)
>>
>>58077365
C.
Even the C++ community is now openly accepting the flaws and has made it clear they're remodeling c++.
So why learn something that will be considered problematic practice in the future?
C knowledge will always be relevant though.
>>
what are some common java exceptions i could include in my project to show employers

guyse, i am such a l33t pr0 dev. i know exc3pti0ns, xD
>>
>>58077384
>they're remodeling c++.
yeah while c keeps ignoring 50 years of PLT.
>C knowledge will always be relevant though.
>C knowledge
kek. C is a programming language for the programming techniques of the past.
>>
I'm a fucking moron and still can't get past these linker errors.

Header.h
#pragma once
int whatPage;

void Menu();
void Game();


main.cpp
#include "Header.h"
#include <iostream>
using namespace std;

int main()
{
whatPage = 0;
while (whatPage == 0)
{
Menu();
}
while (whatPage == 1)
{
Game();
}
}


functions.cpp
#include "Header.h"
#include <iostream>
using namespace std;
void Menu()
{
system("CLS");
cout << "MENU\n"
<< "1 Play\n";
cin >> whatPage;
}

void Game()
{
cout << "pls work";
}


>LNK 2005: "int whatPage" already defined in functions.obj (file: main.obj)

>LNK1169: one or more multiply defined symbols found (file anime.exe)
>>
>>58077394
>exceptions
I don't know much about them but they're just error messages essentially right? So why would you care about having error messages if they're not relevant to your program?

Also a more general question:
How can C++ have exceptions if 'you don't pay for what you don't use'. Surely exceptions would be a feature that creeps all over the program as long as they're somewhere? How else could they run up the stack and destroy objects like that?
>>
every time i read "using namespace std" that reminds me how glad i am that i ditched c++ for java.

such a cancerous line.
>>
>>58077431
>public static int main
>>
>>58077421
shouldn't you just include functions.cpp in main.cpp?
>>
>>58077419
>PLT
And look at what good that has done. I'm sure you're in a position where you absolutely love everything that's going on.
>programming language of the past
Sadly, it's one of the few languages that actually allow you to do things easily, efficiently and without tons of uneccesary mental model overhead that comes with most abstractions.

C++ is similar in that but only when you use certain subsets.
>>
>>58077438

public static void main.
its void, my dear stroustrup groupie.
>>
>>58077465
>void
Annoys the living crap out of me that they did that.
I need to find some motivation but it's not like java programs don't have exit status.
>>
>>58077453
>allow you to do things easily, efficiently
no, not at all. everything in C is tedious, boresome, errors prone. Try to implement a generic dictionary in C, for example.

>>58077465
>stroustrup groupie.
Rob Pike, actually.
https://www.youtube.com/watch?v=5kj5ApnhPAE
>>
>>58077450
If that means changing main.cpp to look like this, it doesn't work.:
#include "Header.h"
#include "functions.cpp"
#include <iostream>
using namespace std;

int main()
{
whatPage = 0;
while (whatPage == 0)
{
Menu();
}
while (whatPage == 1)
{
Game();
}
}
>>
>>58077523
nigga you ain't listening
>>
>>58077492
>try to do pointless high level construct in C
Yeah well if your use case aligns well with python or something like that then you can of course use python.
C and other languages that promises or care for performance are not for doing stuff that would be completely bonkers in that field.

I wouldn't ask a python programmer to try and do intrinsics well. It's just not what they are supposed to do.

Languages shouldn't be as general as they are honestly. They should have more specific use cases. PHP and JS are good examples of that. They're not good languages but they are where they are because of how they work in their own area.
>>
what is the go-to file structure, if I want to create a list of custom objects?

i have no clue how I will use them - yet.
>>
>>58077546
>try to do pointless high level construct in C
not pointless at all. ever heard of json or xml? do you have any experience outside of cs101 assignments?
>>
>>58077553
What do you mean?
>>
>>58077565
>have you ever heard of inefficient ways of storing data in text
I've heard of plenty of ways of doing that yes. But again, not the way you go about things if you want speed.

In C you'd have a clear input boundary where you take the JSON (hopefully you don't even need to take JSON), translate it into something for proper ladies and then work with it. If it absolutely has to go back to JSON then I could say you probably didn't choose the right language.

And C++ doesn't really do much better.
>>
>>58077613
>And C++ doesn't really do much better.
wrong
https://github.com/nlohmann/json
>>
File: 1480274262652.png (43KB, 388x400px) Image search: [Google]
1480274262652.png
43KB, 388x400px
Why aren't you guys programming in C and why do I love C so much?
>>
>>58077635
Because you've never had a job.
>>
>>58077596

nevermind, i figured out i should use an arraylist.
>>
>>58077635
why do you love Cock so much? faggot
>>>/y/
>>
>>58077544
I still fail to see what it is I'm doing wrong here. I did try to remove Header.h from main.cpp as well, but that just doubled my linker errors.
>>
>>58077658
that's strange, I did the exact same thing you did, then I compiled main.cpp and it just werks.
>>
>>58077653
Does that make me gay if I like it when the male character is drawn as a girl?
>>
>>58077684
if liking means being sexual aroused, yes
>>
>>58077553
You can look at wave (RIFF) for inspiration. The model they have for storing data is pretty good for a general case. And it's a very simple file format.
>>58077627
>wrong
http://www.digip.org/jansson/
Wrong?
Really anon,
>there's a library I prefer
Is not an argument you can pull.
And I can see how you're just a fresh programmer so I know this will go down the route of
>but look at how in one of these libraries I write stuff just like I would with dictionaries
As if that's a good way to go about things.
>>
File: torvalds.jpg (256KB, 1211x1210px) Image search: [Google]
torvalds.jpg
256KB, 1211x1210px
>>
>>58077635
Because its easy to understand. You'd probably feel just the same about LUA if that's where you started.
>>
>>58077706
are you retarded? something like
json j2 = {
{"pi", 3.141},
{"happy", true},
{"name", "Niels"},
{"nothing", nullptr},
{"answer", {
{"everything", 42}
}},
{"list", {1, 0, 2}},
{"object", {
{"currency", "USD"},
{"value", 42.99}
}}
};

or
// create object from string literal
json j = "{ \"happy\": true, \"pi\": 3.141 }"_json;

// or even nicer with a raw string literal
auto j2 = R"(
{
"happy": true,
"pi": 3.141
}
)"_json;

// or explicitly
auto j3 = json::parse("{ \"happy\": true, \"pi\": 3.141 }");


is light years ahead of what you could do with standard C.
>>
>>58077421
Is it possible this is a incremental recompile issue?
>>
>>58077747
>not generating object models based on the JSON structure in the API so you can assign values to fields with type safety, autocompletion, and enums for limited selection options
>>
>>58077421
Make whatpage static, famalamadong.
>>
System.out.println("Take it Easy");
>>
>>58077747
>ahead
Again. This toxic perspective. Hopefully you will grow out of it.

As an aside if you're declaring a lot of json in your programming language you're probably doing something horribly wrong. Seems like a very problematic environment to work in.

Why wouldn't you just keep a couple json files on disk and parse them? Instead of having it all littered throughout your code.
>>
>>58077719
>he said that in 2007
>he hasn't wrote code since git
>linux is now awkwardly using oop

>>58077807
what's matter here is the abstraction techniques offered by c++.
another example of C++ destroying C
https://roartindon.blogspot.be/2014/10/compile-time-murmur-hash-in-c.html
>>
>>58077632
>is it important to type fast
Not really no.
As long as your thoughts aren't held back by your typing.
It's rare for that to be the case.
>>
why is popular programming culture so juveline and childish?

it all revolves around meme arguments and buzzwords. oh, and look at how architects of programming languages look and dress like, like fucking teletubbies.

no wonder that people with social lifes stay away from coding, as it reeks of the same flavours as anime and gaming.
>>
>>58077899
>no wonder that people with social lifes stay away from coding,
Good. Normies ruin eveything.
>>
>>58077773
That worked, thanks a bunch!
>>
does it make sense do save dates in text files as Date objects in Java?
>>
>>58077899
I think it's something related to memes and the idea that it's almost impossible to create all knowledge from scratch.
>>
>>58077899
It's really any male dominated industry anon. You find it anywhere.
People arguing about drillbits, screwdrivers and what type of foam is best to use when there's clear data on what's actually correct.
>>
I FACKEN HATE CURRYOVERFLOW

THEY DOWNVOTE EVERYTHING I ASK

REEEEEEEE
>>
>>58077985
Why would you ever ask shit on SO?
Everything's already answered there or can be found out by RTFM
>>
>>58077985
Why aren't you posting everything on /dpt/?
We have the best devs
>>
>>58077997
>>58078008

i asked what a good way to arrange my first custom library is.

should i implement it as package?
should i put all the classes in one file?
or every class in its own file, and these files into a folder?
>>
>>58077899
If there's one good thing about the "GIRLS CAN KODE(tm) TOO!! :)" movement it's that it's going to kill the bizarre "nerd safespace" culture that's taken over programming and turn it into just another job, which is all it is and all it should be.
>>
>>58078014
What language are you using?
>>
>>58078022
>ill the bizarre "nerd safespace" culture that's taken over programming and turn it into just another job, which is all it is and all it should be.

NO
NO

please not

/g/ is my last safe space from the harsh reality out there ;____;
>>
>>58078025

Java.

>inb4 Pajeet
>>
>>58078034
>harsh reality
Life could be so simple if human were actually trying
>>
>>58078057

yes, brother.

anime and communism for real soon. or so i hope ;____;
>>
>>58078057

Shut the fuck up, commie.
>>
>>58078014
>should i put all the classes in one file?
why would you ever do that
>>
>>58077079
What editor is that?
>>
do you, if you are an actual dev with an actual job in the industry, earn more than your friends?

i notice that i have a far more relaxed and fun job than my friends in medicine and economics, but the pay is not really greater, about the same.
>>
>>58078022
>girls can code too movement
If you think this does anything you've been completely out of the loop for maybe 40 years.
Promoting women in electrical engineering and software has been going on for a very very long time.
I don't think anything will change just because the socially conscious right wing groups are paying attention to the way affirmative action is a form of discrimination.

You're just overreacting to nothing. Women aren't in software for some reason, I don't know why, but its not from lack of marketers trying to change that.
>>
>>58078048
Every class must have its own file unless private. In Java you just make your own package and you distribute it as a single Jar archive.
>>
>>58078078

some retard recommended me to do that.
guess because he is a retard.

so i should use the package keyword for all my classes and put them in one folder, amirite?
>>
>>58078086
>/dpt/
>jobs
>>
>>58078098
maybe he meant packed into a single JAR?

>so i should use the package keyword for all my classes and put them in one folder, amirite?
Do you not use an IDE?
It should take care of the correct file hierarchy already and exporting libraries already
>>
>>58078079
VS Code
>>
>>58078098
Anon definitely was not retarded. You've never mentioned the language you were using since you're a fucking duck and it's the proper way to do it in both C and C++ for really small libraries.

No wonder you're getting downvoted baka
>>
>>58078086
Software developers do earn a lot compared to the effort they put in if they're at least on the verge of being competent.

Other fields seem to have standards or are undervalued. I think that's why.
Programmers should probably be paid less.
>>
>>58078022
never. programming/computer science will keep being the first refuge to nerds.
>>
File: giphy.gif (2MB, 500x281px) Image search: [Google]
giphy.gif
2MB, 500x281px
>machine is compromised on our network
>they're going to install anti-virus on it as a complete response
>>
>>58078118

i was tasked to add a library to an existing project.

>>58078126

i mentioned the language on curryoverflow. that said, lets refrain from even mentioning these autistic pajeets here further.
>>
>>58077635
But I am.
>>
>>58078014
>arrange
Well you need to know details for that (or tour answer can be found by searching).
Stackoverflow is quite explicit about questions being more for the general audience than the person asking.
>>
fp is so comfy
>>
am I the only one who purposely screw up the formatting of my posts to pretend "I'm not trying hard anyway"?

>how is it related to programming
blabla I'm an AI
>>
>>58078174
No. I do genuinely not care that much though.
>>
does anyone have experience with converting Flat Files into Java Objects?
>>
>>58078191
Yes. Just blow air into them until they're no longer flat.
>>
>>58078014
http://stackoverflow.com/questions/3226282/are-there-best-practices-for-java-package-organisation?rq=1

There are probably other similar questions that have been asked and answered.
>>
its the first time im trying to use a custom framework in my java project.
what would be a good tutorial to look at?
>>
Java containment thread when?
>>
>>58078086
Dev with only 2 years experience.

I'm not making as much as some of my other friends, but I really love my job. I get paid about my cities median household salary, which is pretty good considering I'm a single earner.

I probably had over 35 paid days off in 2016. Went to Germany, Vegas twice, Orlando, Miami. Vegas (once) and Miami were completely paid for so I could let vendors get me trashed at conferences. We get Free Beer Fridays, and I can work from home whenever I want.

All in all, I know I could make $20k more down the street, but I really love it here.
>>
>>58078277

youre already typing in there, bro.
>>
>>58078269
what framework?
>>
>>58078296

eh, a library, not a framework. not that i know the exact difference.

http://jffp.sourceforge.net/
>>
>>58078296
>>58078310
Doesn't Java have something like NuGet?

You should be able to type a simple command to import any popular public library into a project.
>>
>>58078291
You're right. Just noticed we had a functional programming thread.
>>
>>58078336
>functional programming

>>/his/
>>
>>58078335
I think you can just add libraries with your IDE
>>
>>58078335
You can make your projects with Maven.
It automatically fetches third-party libraries.
>>
>>58078349
>object oriented programming
>>>/int/
>>
What is the best language to perform lots of computations in?
>>
>>58078371
>implying OOP is not the default paradigm of today
>>>/b/
>>
>>58078349

all telecom services and apps run on fp
so will big data in a few years
>>
>>58078399
>default paradigm
Ask yourself why people able to make their own opinions disagree with you and castrate yourself.
>>
>>58078431
telcos are fucking trash though
>>
>>58077840
>he hasn't wrote code since git
Just wrong.

>linux is now awkwardly using oop
It is not.
Also he's critique was not on OOP(that is also shit for that matter), it was on c++. Contrary to what illiterate fucks like you might think, c++ is not c with objects. It wouldn't even make sense to create a c with objects, since you can do OOP in c.
>>
If I program C and use clang extensions how much do I hurt portability?
I don't really care if you can only compile with clang but it can compile to every relevant platform right?
>>
>>58078349
>>58078371
>>58078399
>>>/out/

And never come back, you're the tumor of this website.
>>
>>58078349
>>58078371
>>58078399
>>58078450
Same person.
>>
>>58078450
>you're the tumor of this website
>>>/reddit/
>>
>>58078191
what do you mean by Flat Files?
>>
File: productimage_4309.jpg (16KB, 480x283px) Image search: [Google]
productimage_4309.jpg
16KB, 480x283px
>>58076261
I want to start building something like this remote, but I am too fuckin lazy mang.
It should be a real remote and not some cable shit though
>>
File: ZSomeAnonOn4ChanFailedAgain.png (3KB, 170x93px) Image search: [Google]
ZSomeAnonOn4ChanFailedAgain.png
3KB, 170x93px
>>58078463

not really
>>
>>58078437
>call ambulance
>service is coded on python
>end up getting connected to pizza hut

>call the police
>some dude called at the same time and the system failed
>all communications down in the entire area

>1000 people talking at the same time
>parallelization shits the bed
>all communications down in the entire area
>>
>>58078469

plain text like this.

E    0    5673    Core Infrastructure    Eisenstr. 43    12345    DE    65428    R�sselsheim    0    
FE 0 5674 I.Solutions Eisenstr. 56 12345 DE 65428 R�sselsheim 0


I have to extract the data out of these and make it into "company" objects.
>>
is there a reason to use arraylists over arrays, if i know the maximum number of entrys already?
>>
>>58078500
look up CSV libraries
>>
>>58078523
You should always use raw arrays unless you can't
>>
>>58078541

i have been told that lists are useful, if i want arrays of unlimited length.
>>
>>58078523
Generally, no, unless you want to make use of the nifty utility functions that generally come with arraylist types.
>>
What language should I learn first as a noob guys?
>>
>>58078500
Do you have to do this in Java?
>>
>>58078567
C#

http://www.csharpcourse.com/
>>
>>58078567
Python, avoid Java and C#.
>>
>>58078553
>>58078541

if, for example, i know that an array can have up to four members, but usually its only one or two ... isnt that a waste of memory to create array [4] each time?

>>58078572

yup. i intend to use simple regex matches, being the vanilla coder i am.
>>
>>58078589
>learning Python for your first language

No, she should be learning C or C++, even Java or C# is better than Python.
>>
>>58078567

Literally does not fucking matter, mate. Just think about what your first project will be and choose whatever language is suitable for it.
>>
All of you are dirty indians writing shit code in Java and C#. This thread and all you are utter garbage.
>>
>>58078610
>learning C or C++ for your first language

just stop.

python is like pseudo-code and nothing better for beginners.
>>
>>58078630
projecting much?
>>
>>58078500
>create a class with the fields necessary to hold data in each column of the file
>read file line by line
>split every line by spaces so you can have a String[] you can work with
>create an instance of the class you defined previously with the data in the String[] you just collected
>>
>>58078603
>if, for example, i know that an array can have up to four members, but usually its only one or two ... isnt that a waste of memory to create array [4] each time?

Why do you not know beforehand what size the array will be and set its length accordingly?
>>
>>58078644
>meme words
>>
>>58078652
not an argument.
>>
>>58078631
The problem is that Python is very different from C, C++, C#, and Java, mostly in syntax and typing, as well as that it's a scripting language.

You can easily move from C# to Java, or vice versa. Even C/C++ have very similar syntaxes and typing rules.

Python is the ugly duckling here, and tends to be harder to come from into these other 4 languages that are easily the most popular non-Javascript languages.
>>
>>58078647

because the object type is "words". the lexicon may or may not provide synonyms, up to 4, for each word.

a word may or may not have synonyms, and i wonder whether to handle the synonyms of a word as arraylist or array [4].
>>
>>58078646
His sample has spaces inside fields as well.

He's probably best off writing a regex with groups for every field.
>>
>>58078660
>The problem is that Python is very different from C, C++, C#, and Java
so what?
problem solving skils are far more important than the language you're learning.
>>
>>58078646

that is how I intended to do it.
i just wondered whether there is a more "pro" method.

>>58078689

is this very bad, performance wise?
if the file has 4000 objects, the computer has to apply a very complex regex 4000 times.
>>
>>58078658
Your comment was not an argument wither. Fucking
>>
>>58078699
4000 is fucking nothing
Don't worry about performance before it's an actual problem.
>>
>>58078701
saying "not an argument" is not an argument, is not an argument.
>>
>>58078567
Python
>>
>>58078670
Sounds like the length of the collection is variable, so the easiest type for the collection would be one that has a variable size, thus something like an arraylist.

That seems more elegant to me than always having an array of size 4 with a variable amount of null values in it, and then having to do nullchecks and such.
>>
>>58076261
>What are you working on, /g/?
Installing Fedora on my 2nd ssd, finally escaping the aids ridden clutches of windows.
>>
>>58078710

the issue is: this is an recruitment test.
i feel like i have to do it the best way possible.

also, my actual text looks like this.
R    1    118725-24-9    612-118-00-5    405-080-4    0    0    0    0    0    0
RN 1 0 DE (1,3-Dioxo-2H-benz(de)isochinolin-2-ylpropyl)hexadecyldimethylammoni...
RN 1 0 EN (1,3-Dioxo-2H-benz(de)isoquinolin-2-ylpropyl)hexadecyldimethylammoni...
R 2 118725-25-0 612-118-00-5 405-080-4 0 0 0 0 0 0
RN 2 0 DE 1H-Benz(de)isochinolin-2(3H)-propanaminium, N-hexadecyl-N.N-dimethyl-1,3-dioxo-,bromid
RN 2 0 EN 1H-Benz(de)isochinoline-2(3H)-propanaminium, N-hexadecyl-N.N-dimethyl-1,3-dioxo-,bromide

chemicals, in case you were wondering. i have to parse this text into "chemicals" objects.
>>
>>58078724
It actually is.
>>
File: asdf.png (602KB, 600x800px) Image search: [Google]
asdf.png
602KB, 600x800px
>>58078710
>>
File: f8d.jpg (74KB, 680x664px) Image search: [Google]
f8d.jpg
74KB, 680x664px
>>58078441
>Just wrong.
https://youtu.be/MShbP3OpASA?t=22m5s

>It is not.
It is. Linux is full of virtual procedure tables defined by hand and macros.

>Also he's critique was not on OOP(that is also shit for that matter), it was on c++.

he wrote

"""
inefficient abstracted programming models where two years down the road
you notice that some abstraction wasn't very efficient, but now all
your code depends on all the nice object models around it, and you
cannot fix it without rewriting your app.
"""

>It wouldn't even make sense to create a c with objects, since you can do OOP in c.
You manifestly don't know what an object is. Maybe the time for you to read a PLT 101 book has come.
>>
>>58078724
i'm not an argument it can't think that i ditched c++ does not an argument" is not from csharpcourse use class in c
shouldn't you choose the deepest, darkest collection to instance "not an arguments"? not an argument, int, int, int, int, int, bool
should be and not an argument.
please? it's not an argument.
you're not an argument to curryoverflow
blabla i'm gonna go back to java exceptions
i don't work
>>
>>58078748
Nope.
>>
>>58078746
And you define this "chemicals" object or do you have to use one already built?
>>
>>58078782

i define it. thats not the problem, i know what these numbers and strings mean, e. g. what attribute of the chemical they describe.

i am just looking for an elegant way to parse this stuff into objects.
>>
>>58078797

this is what a chemical substance looks like
    public class Substance {

String nodeId;
String casCode;
String euIndexCode;
String einecsCode;
boolean gadslClassDeclarationDuty;
boolean gadslClassUnwanted;
boolean gadslClassProhobited;
boolean isReach;
boolean isDeleted;
boolean isHidden;

}
>>
is there some kind of OP pastebin for /dpt/ ?
>>
>>58078797
>Java
>Elegant

Yeah, you could do this really elegantly in other languages, but I wouldn't go for that.

If you have to do it in Java, make it work, then you can go back and try to make it "pretty".

Look for a CSV library that will do the heavy-lifting for you.

Alternatively, read line by line and split on a tab character, sorting the information into the respective classes.

Looks like you'll need two classes. One for each "header", and one for the multiple entries under each "header".
>>
>>58078746
Do you need to separate the names too?
You'd probably want to split manually then.

Otherwise, I'd say a nice regex with named groups would be the best way.
Regex (without fancy stuff like look-behinds) is very quick if it's implemented properly.
>>
>>58078797
just read the file line by line and parse each line
>>
>>58078827
No, and there never will be.
That's general faggotry.
Nobody will agree.
>>
>>58078827
No, because we agree on basically nothing. It's up to you to properly enunciate what you desire, and then cross-reference the responses you get from us with your own research.

What are you looking for?
>>
>>58078829

tbqh, i know python and c++, and i would have used regex here as well. i simply have no other tools at my disposal to do this parsing of text into data (yet).
>>
>>58078844
>>58078840
What about some basic (i mean simple) programming books recommendations? I know installgentoowiki has this but why can't we have some kind of links collection?
>>
>>58078768
>https://youtu.be/MShbP3OpASA?t=22m5s
He literally says he optimizes code to the level of single instructions.

>https://github.com/torvalds
December 2016
192 commits

>It is. Linux is full of virtual procedure tables defined by hand and macros.
That's is not OOP.

>he wrote
I didn't say he liked OOP either, dumb faggot, I said that the he did not criticize OOP in the post you replied to. And he really did not. Fucking imbecile.

>You manifestly don't know what an object is. Maybe the time for you to read a PLT 101 book has come.
I actually do know and I have programmed a lot in OOP. You are just a dumb memester that learned some memes in the first semester of college and now comes to meme on 4chan, together with other retarded memester that now idea of how a computer works what so ever.
>>
>>58078865
No way would I approve of links that even mentioned Java or PHP or Javascript
>>
>>58078833

i also have to parse the file "object by object", whatever that means.
so not line by line, but "some lines by some lines", or something along the lines ...
>>
>>58078776
It is, really, dumb faggot.
>>
>>58078865
Because that varies wildly based on what language you want to learn, and more importantly what you actually want to do.

I think the Yellow book is great for beginners, because it goes over programming concepts really well before you even touch code:
http://www.robmiles.com/c-yellow-book/
>>
>>58078830
>Otherwise, I'd say a nice regex with named groups would be the best way.

thats the only way i can think of, so a regex will be it, then.
>>
>>58078879
what?
i have no idea what that means
>>
> go to interview
> interviewer ask me a programming question
> start to solve it in haskell
> "umm, anon i don't know haskell, can you do it in other language?"
> "uh sure..."
> remeber seeing some C code on /dpt/
> don't remeber anything
> start sweating
> drop my spaghetti
> got the hell out of there

JUST
>>
>>58078900
You should've told him to fuck off
>>
>>58078894

see, each object is descripted in MULTIPLE lines.

like,

name of object 1
color of object 1
price of object 1
name of object 2
second name of object 2
color of object 2
price of object 2
name of object 3
color of object 3
price of object 3


so i have to define where an object ands and where it begins manually.
>>
>>58078900
>limiting yourself to one language
>>
>>58078892
You can use Java's String split method (but I think that actually uses regex too).

Or just read character by character, filling up a buffer, and copy the buffer to the respective variable once you hit a space,...
>>
>>58078900

anon, but knowing only haskell really isnt practicable.
>>
>>58078937

does that make for a better performance?
in comparison to regex for whole lines?
i am asking because the file length is 50000 substances.
>>
File: wow anon.jpg (78KB, 884x574px) Image search: [Google]
wow anon.jpg
78KB, 884x574px
>>58078867
>192 commits
You're embarrassing yourself, those are merges of contributions not from him. Read the logs.

>That's is not OOP.
I specified that linux is doing it _awkwardly_

https://lwn.net/Articles/444910/
https://lwn.net/Articles/446317/

>I actually do know and I have programmed a lot in OOP.
Please show me an object in C (/me popcorn)
>>
>>58078953
yes, a lot faster
>>
>>58078953
In Java? It's probably slower than its optimized standard library functions.

You can also look at java.util.StringTokenizer
>>
File: ok.png (233KB, 1074x1126px) Image search: [Google]
ok.png
233KB, 1074x1126px
I did it! ;-)
>>
>>58079004
>showing the answer
u memer
>>
>>58078981
struct Animal_Table{
typedef void (*Walk_Fun)(struct Animal *a_This);
typedef struct Animal * (*Dtor_Fun)(struct Animal *a_This);

Walk_Fun Walk;
Dtor_Fun Dtor;
};

struct Animal{
Animal_Table vtable;

char *Name;
};

struct Dog{
Animal_Table vtable;

char *Name; // Mirror member variables for easy access
char *Type;
};

void Animal_Walk(struct Animal *a_This){
printf("Animal (%s) walking\n", a_This->Name);
}

struct Animal* Animal_Dtor(struct Animal *a_This){
printf("animal::dtor\n");
return a_This;
}
>>
>>58078812
>>58078746
So something like this?

Not Java, but you should be able to use the basic logic and Java equivalents:
static void ReadSubstancesFromFile(string path)
{
var substances = new List<Substance>();

foreach (var line in ReadAllLines(path))
{
var items = line.Split('\t');
if (items[0] == "R")
{
substances.Add(new Substance()
{
Id = items[1],
casCode = items[2]
///... etc
});
}
else // "RN"
{
substances.First(x => x.Id == items[1]).locales.Add(new SubstanceLocale()
{
Id = items[1],
LocaleCode = items[3],
Name = items[4]
});
}
}
}
>>
>>58079004
why does Project Euler have to bully languages without BigInts so much?
>>
>>58079032
>why does Project Euler have to bully languages without BigInts so much?
I wrote this in C, nigger.
>>
>>58079034
post code so i can laugh
>>
>>58079025

thanks, this template could help a lot!
>>
>>58079032
It really doesn't.
>>
File: wat.png (26KB, 1069x289px) Image search: [Google]
wat.png
26KB, 1069x289px
>>58079051
really simple shit
#include <stdio.h>
#include <stdlib.h>

#define LEN 1001
char *titel = "1000.txt";

int main()
{
char buffer[LEN];

FILE *fp;

if((fp = fopen(titel, "r")) == NULL)
{
printf("%s konnte nicht gelesen werden.\n", titel);
return 1;
}

fscanf(fp, "%s", &buffer);

// printf("buffer: %s\n", buffer);

int i, j;
unsigned long max = 0;
for(i = 0; i < (LEN - 14); ++i)
{
unsigned long product = buffer[i] - '0';
for(j = i+1; j < i+13; ++j)
{
product *= (buffer[j] - '0');
}
if(product > max)
{
printf("new max: %lu\n", product);
max = product;
}
}

printf("max: %lu\n", max);
return 0;
}


fuck. I don't know how to appproach the next problem. I don't want to do hardcore bruteforce again ;_;
>>
>>58079019
Those are simple data types, they are not even abstract data types. Objectification is about the abstraction of both the data and the implementation of the interface; what you did here have neither. Your code is not even standard.
>>
>>58078395
FORTRAN
O
R
T
R
A
N
>>
>>58079025
albeit i have trouble figuring out what this line means.

>substances.First(x => x.Id == items[1]).locales.Add(new SubstanceLocale()
>>
>>58079055
That's the beauty of knowing C# or Java; if you know one, you can probably almost copy/paste the other and tweak to language-specific things.

For what its worth, I made two structs just to get the object-like thing ready, and doing it like this nests the locales as a list of structs within the Substance struct. You could do proper object, though:
public struct Substance
{
public string Id;
public string casCode;
public string euIndexCode;
public string einecsCode;
public bool gadslClassDeclarationDuty;
public bool gadslClassUnwanted;
public bool gadslClassProhobited;
public bool isReach;
public bool isDeleted;
public bool isHidden;
public List<SubstanceLocale> locales;
}
public struct SubstanceLocale
{
public string Id;
public string LocaleCode;
public string Name;
}
>>
>>58079089
Not him, but what is the point of using structs over classes?
>>
>>58079081
In English:

>Take the first object from the 'substances' collection that matches the condition that its 'Id' match the second item on this line, and add to this object's list of locals a SubstanceLocale defined as the following...
>>
>>58078981
>>You're embarrassing yourself, those are merges of contributions not from him. Read the logs.

>a merge consists purely of typing 'git merge branch', it does not require any code or conflic resolution to be written

>I specified that linux is doing it _awkwardly_
It is simply not OOP. You are stupid and have no idea what you are talking about. Stop taking your 'opinions' from shit forums and 'tech news' websites.

>Please show me an object in C (/me popcorn)
typedef struct {
int (*open)(void *self, char *fspec);
int (*close)(void *self);
int (*read)(void *self, void *buff, size_t max_sz, size_t *p_act_sz);
int (*write)(void *self, void *buff, size_t max_sz, size_t *p_act_sz);
// And data goes here.
} tCommClass;

tCommClass commRs232;
commRs232.open = &rs232Open;
: :
commRs232.write = &rs232Write;

tCommClass commTcp;
commTcp.open = &tcpOpen;
: :
commTcp.write = &tcpWrite;
>>
>>58079111
It was easier for me to type it right next to the method I was quickly hacking out.

There are other considerations between structs/classes, but in this case, I like to call the data structure a POO, or "plain ol' object".

You know, to make my jargon more comfortable to our friends across the pond.
>>
>>58079111
stack allocation vs heap allocation
>>
>>58079089
public struct Substance
{
public string Id,
casCode,
euIndexCode,
einecsCode;
public bool gadslClassDeclarationDuty,
gadslClassUnwanted,
gadslClassProhobited,
isReach,
isDeleted,
isHidden;
public List<SubstanceLocale> locales;
}
public struct SubstanceLocale
{
public string Id,
LocaleCode,
Name;
}
>>
>>58079077
>Those are simple data types, they are not even abstract data types.
Doesn't matter what your meme language says. Everything is data and every data has a type.
>>
>>58079112

oh my, thanks a lot.
im glad i got into programming, such lines are what makes it worth it.
>>
>>58079152
>not
public struct Substance
{
public string
Id,
casCode,
euIndexCode,
einecsCode;
public bool
gadslClassDeclarationDuty,
gadslClassUnwanted,
gadslClassProhobited,
isReach,
isDeleted,
isHidden;
public List<SubstanceLocale> locales;
}
public struct SubstanceLocale
{
public string
Id,
LocaleCode,
Name;
}
>>
>>58079152
No, thanks.

It's easier to change access level and datatype when you don't use character-saving bullshit like that.

In the same regard, I virtually never forego brackets on something like an if-statement, even if it's only one line.

>>58079170
Keep in mind that this line is using C#'s LINQ (
.First(x => ...)
, so you'll have to find whatever lambda syntax Java has to duplicate it.

I honestly would go about this a very different way, but I'm not sure what the Java way is, so I made it very basic.
>>
>>58079190
Java has streams, which are a somewhat shitty version of C# LINQs.
>>
>>58079190
i will try to tweak the code in a way so I can implement

>substances.First(x => x.Id == items[1]).locales.Add(new SubstanceLocale()
>>
Is it true that design patterns are a meme and should be avoided?
>>
File: 234.jpg (28KB, 380x250px) Image search: [Google]
234.jpg
28KB, 380x250px
I hate the arrow functions meme.
>>
>>58079234
what don't you understand?
>>
>>58079222
They should be used when appropriate.
>>
>>58079234
this.get() => out()
>>
>>58079245
I understand, just think the syntax is ugly desu.
>>
what is the right data structure for a number without commas, with 18 digits?

still int?
>>
You may use Karen, but always remember that she belongs Brit/pol/.
>>
>>58079262
char *number;


prove me wrong
>>
>>58079262
A 64-bit integer can hold up to 20 digits, so yes
>>
>>58079282

you are thereby proven wrong.

>>58079288

would still use a long then, tbqh.
>>
File: anal beads.png (17KB, 689x267px) Image search: [Google]
anal beads.png
17KB, 689x267px
>>58079206
Here's what I would normally do in C# if I wasn't worried about nesting the locales:

static void ReadSubstancesFromFile(string path)
{
var input = ReadAllLines(path).Select(x => x.Split('\t')).GroupBy(x => x[0]);
var substances = input.First(x => x.Key == "R").Select(x => new Substance()
{
Id = x[0],
casCode = x[1]
// ...
// assign Substance properties with values from each "R" line
});
var substanceLocales = input.First(x => x.Key == "RN").Select(x => new SubstanceLocale()
{
Id = x[0]
// ...
// assign SubstanceLocale properties with values from each "RN" line
});
}


This gives me
IEnumerable
collections that have delayed execution, so they don't do work until I query them for a particular subset of items.
>>
>>58076261
Haxoring this:

http://www.gamesdeal.com/christmas-event-2016.html

However for some reason I get "REWARD CODE" instead of the real reward. Fucking kikes.

>inb4 pirate asshole
>inb4 what you're doing is illegal
>>
File: Imperial Leather.jpg (22KB, 620x413px) Image search: [Google]
Imperial Leather.jpg
22KB, 620x413px
Imperial Leather
>>
>>58079310
What's the reasoning behind naming arrow function arguments 'x' meme?

See it all the time desu.
>>
>>58079320
>>>/global/rules/2
>>
>>58079310
lel
why are you demonstrating what you would do in c#, if he was writing in java all the time?
>>
About 75% through my second React Native app.

Just got a non-profit to sponsor the app for a cool 8k (I'm only rebranding, and anything in the future they want from me we'll have to sign another contract).

Right now I'm
1) Implementing a badge/achievement system
2) Further fleshing out reporting/hiding/blocking user actions (making sure you can unblock someone/asking you `are you sure?`
3) Cleaning up Android styling.

The badging system is likely to take some time.

The app has Microsoft's Code Push in place so I'll only have to submit to the App Store/Play Store once. This is gold compared to the Xamarin development I have done in the past.
>>
>>58079341
because C# and java are very similar
>>
should be programming but feeling lazy. will probably take today off ;-;
>>
>>58079338
It's just a personal (bad) habit.

I default to 'x' on all LINQ blocks, because they're generally short and wouldn't benefit all that much from meaningful names. You already know you're working with each element in a given collection, and you can just mouseover the x to see the type if you're working on it.

You could always give a short name like 'line' or 'substance', and it could really help someone reading your code after the fact.

>>58079341
Wanted to demonstrate that even though C# and Java are very similar, basic language features can greatly change the average person's approach to a problem.
>>
File: tumblr_n4bcw60K0j1s784jpo1_1280.jpg (265KB, 1024x765px) Image search: [Google]
tumblr_n4bcw60K0j1s784jpo1_1280.jpg
265KB, 1024x765px
somebody help me out with some sicp rq
https://hastebin.com/ufewoyiwux.lisp
inc and dec are increment and decrement
obviously we are incrementing b but how is that happening?
>>
>>58079358
>React Native app.
noob here.
what's this? a web browser application or a mobile aplication (Android?)?

what was the first app you made about?
>>
Hello, /dpt/, I found this general from Brit/pol/.

They said it's a comfy general.

How do I learn programming?
>>
>>58079338
I always think of f(x) = y
Also,
>arrow function
>>
>>58079358
>The app has Microsoft's Code Push in place

That's...actually pretty neat. I've never heard of it:
https://microsoft.github.io/code-push/
>>
whenever i write a large program, i do it all in a single file, before creating a package of multiple files.

is that bad style?
>>
>>58079393
you don't you fucking queer

get out lad
>>
>>58079409
As long as the end product is up to par, who cares how you get there?

Consequentialism is the best ideology.
>>
>>58079358
Some technical things:

The app doesn't have a server. I'm using Firebase for storage/database. Although, Firebase is a great service, this has been a huge limitation. I am not likely to be using Firebase in the future, as I don't believe it's production ready (being limited to one `where` clause per query). Pagination has been a pain, a lot of work-arounds require storing data in two locations in the JSON schema.

Everything has been made with ES7 specs. Async/await/etc. The code makes me a feel like a Medium Blogger Cool Kid â„¢
>>
>>58079409
All programs should be a standalone portable exe.
>>
>>58079393
see
>>58078891
>>
>>58079387
Native UI on Android and iOS w/ React.JS.

Similar to NativeScript.

The first app I made was the Yelp of public restrooms. Lol.
>>
> fuck around with sound settings
> suddenly firefox video player volume is always set to around 40%
> fixes don't work
> write a Python script that fetches all webms from a given 4chan thread so I can play them in mpv instead
Only downside is having to wait for them all to download but then again most threads either don't have lots of webms so the additional data isn't an issue, or they have lots of webms most of which I want to watch anyway.
>>
>>58079406
Microsoft's been doing some great things in 2016.

I haven't connected my development device to my computer in a couple weeks because of it. Highly rec!
>>
>>58079077
>they are not even abstract data types
they literally have 1 layer of abstraction above primitives
>>
This one was easy.

#include <stdio.h>

char isPrime(unsigned long);
unsigned long sum = 0;


int main()
{
unsigned long i = 2;

while(i < 2000000)
{
if(isPrime(i))
sum += i;

++i;
}

printf("sum: %lu\n", sum);
return 0;

}


char isPrime(unsigned long n)
{
if(n <= 1)
return 0;
else if(n <= 3)
return 1;
else if((n%2 == 0) || (n%3 == 0))
return 0;
unsigned long i = 5;
while(i*i <= n)
{
if((n%i == 0) || (n%(i+2) == 0))
return 0;
i += 6;
}
return 1;
}

>>
>>58079465
No kidding. I watched the live stream of //build this year and it's actually pretty exciting what they're doing on the dev side of things.

Windows still a shit, but their DevDiv knows what the fuck's up.
>>
what does finally do in java?
>>
File: easy.png (20KB, 1038x257px) Image search: [Google]
easy.png
20KB, 1038x257px
>>58079481
forgot pic.
>>
>>58079488
The same thing it does in other languages with
try/catch/finally
.

>No matter what (exception or not!), do this before you leave this block of code.

It'll happen whether or not an exception is thrown.
>>
>>58079488
ensures the code within is always run, no matter what
>>
>>58079340
>You will immediately cease and not continue to access the site if you are under the age of 18.
>Ahaha
>Implying I'm not doing it for fun.
>Implying people over 18 don't play games.
>Implying you aren't a fucking retard.
>>
>>58079488
memes
>>
File: wutsdis.png (88KB, 1032x533px) Image search: [Google]
wutsdis.png
88KB, 1032x533px
Is dis i raff i ruse?
>>
try { 
BufferedReader infile = new BufferedReader (new FileReader(filepath));
infile.close();
}

catch (IOException exc) {
System.out.println("Could not read " + filepath + ".\nPossibly, it is not a text file?\n");
}


Is this the right order?
It seems strange to me to catch an exception in this way, because the second line (close) can have exceptions of its own.
>>
>>58079552
No,
infile.close()
must be in the finally block. It's up to you what to do with the exception close throws.
>>
>>58079552
put the close() call in a finally block
>>
Can someone explain REST to an idiot?
>>
>>58079455
you don't need an extra script for that:

curl 4chanthread | grep -E -o "//is.4chan.org/[a-z0-9]+/[0-9]+\.webm" | uniq | sed 's/^/https:/' | xargs mpv
>>
>>58079549
Wut? I think I know a solution, just think about it.
>>
>>58079583
I would just read that shitty grid into an array and then test every fuckin combination. Can't make up any other good solution
>>
>>58079032
you don't need a bigint since the maximum value of the product is 9^13 = 2^41 < 2^64 - 1
you can just treat the 1000 digit number as a string and iterate over it lol
>>
>>58079597
PROTIP: the diagonals are your arrays to test.

For example, you'll have:
08
91, 00
77, 62, 65
...

Then sort them by largest numbers and grab the first 4 elements from each jagged array of numbers
>>
>>58079582
bu that's too slow , m8
>>
File: hrmm.png (22KB, 623x498px) Image search: [Google]
hrmm.png
22KB, 623x498px
>>58079549
i solved this yesterday pic related

its the next ones that get hard. you can brute force 1-11 quite easily after that it requires optimzation.
>>
>>58079582
Oh.
Yeah, I figured it was possible to do this way but I'm more comfortable with Python than with bash for now so that's what I used.

>>58079648
How so? I didn't run it to test but I doubt the language and implementation will have much of an impact on the run time, since most of it is spent just downloading the actual files.
>>
>>58079625
won't work on my 8-bit computer
>>
>>58079648
It's actually faster since it doesn't fetch every video first
>>
>>58079650
my advice is get top left to bottom right, top right to bottom left, bottom left to top right, bottom right to top left.

then teh horizontal and vertical then just use your algorithm from the 1000 digit product like it was challenge 8 i think to solve from there.
>>
>>58079158
Is "it's a meme" your only argument? Sorry for having read PLT literature from praised computer scientist like William Cook or Luca Cardelli. You should definitively read Object-oriented programming versus abstract data types from Cook or A theory of Objects from Cardelli to fill your lack of knowledge on the subject. Object-Oriented Programming Languages: Application and Interpretation also has a good chapter on the subject.
>>
>>58079705
Yeah this would be kinda my approach, I guess.
>>
>>58079704
>curl 4chanthread | grep -E -o "//is.4chan.org/[a-z0-9]+/[0-9]+\.webm" | uniq | sed 's/^/https:/' | xargs mpv
can you give me a run down on this command to see what it does?

-E ?
-o ?
uniq ?
sed ?
>>
>>58079734
-E extended regex
-o output the match only
uniq display only unique values in the output
sed replace the match with nothing
>>
New thread:

>>58079752
>>58079752
>>58079752
>>
>>58079734
>-E
extended regexp for grep
>-o
output only the matching string instead of the whole line
>uniq
kills duplicate lines, since the urls are twice in the 4chan page
>sed
add "https:" to the beginning of the line
>>
Hey, fellas, who knows Python/Flask? I write miiicroservice and i need to add some kind of single admin page and authentication form for it. This is not multiuser service, so i need only one admin account. How can i implement it without DB?
>>
>>58079762
Thank you.
>>
>>58079769
good call on the sed, i replied with incorrect information mistakenly
>>
File: Untitled.png (1011KB, 960x1040px) Image search: [Google]
Untitled.png
1011KB, 960x1040px
>>
>>58079769
>add "https:" to the beginning of the line
why not adding to the beggining of the line?

like

https://is.4chan.org......
>>
>>58079829
niga what are you trying to say
>>
>>58076457
Each class should, for the most part, have their own header file. You should have a another header file that includes the header files of the classes like so:
foo.h -- class foo
bar.h -- class bar
my_library.h -- #includes the library headers, foo.h and bar.h


#include "my_library"

int main()
{
Foo foo;
Bar bar;
// do stuff
return 0;
}
>>
>>58079843
this
curl 4chanthread | grep -E -o "https://is.4chan.org/[a-z0-9].......
^
|
>>
>>58079861
because for some reason the urls on the 4chan page only say "//is.4chan.org/...."
>>
>>58079881
this is done for compatibility between tls and non-tls requests
browsers fill in the correct protocol if just // is given
>>
>>58079321
Fuck off and suck Hitchens' cock.
>>
>>58079897
wget doesn't, it expects either no leading slashes or a protocol ident like https
>>
>>58080012
exactly: typically, browsers do and curl/wget do not so it needs to be made explicit here by using sed
>>
>>58080029
You could also remove the leading slashes from the regexp, could you not?
>>
>>58080080
you could remove them and then add them in the sed, but that's not important
>>
>>58080098
Then you'd have to use a different separator in sed though (or escape it if you're retarded).
>>
>>58080141
yeah; like i said, it's not particularly important. there are many ways to go about this
Thread posts: 329
Thread images: 30


[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.