[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: 337
Thread images: 17

File: DPT.png (389KB, 934x1000px) Image search: [Google]
DPT.png
389KB, 934x1000px
Old thread: >>55788498

What are you working on /g/?
>>
nothing, my development as a programmer is stagnant.
>>
python
>>
>>55796316
Moving data from point A to point B.
>>
>sizeof(struct a) is not the sum of the sizes of all elements in struct a
This is fucking infuriating.
>>
>>55796534
If you put 4 books in a box, and then weigh it, you get the weight of 4 books and a box.
>>
>>55796550
Also sometimes one of the books will have a pointer to another dimensions.
>>
>>55796534
__attribute__((packed))
>>
>>55796534
It's because types need to be aligned, so there may be padding at the end of the struct or in between members. Pack your structs correctly.
>>
>>55796550
Except when you put 5 books in a box and weigh it and it's the weight of 8 books.

Depressing, even union doesn't overcome this. Time to fuck with memory again I guess.
>>
>>55796600
>>55796550
You're not thinking about it right. It's size, not weight.

You have 5 books, but boxes only come in sizes of 2 books, 4 books or 8 books, so in order to cram everything into one box, you need one 8 book box.

>>55796600
See >>55796597 and >>55796592
>>
Beginner doing some python scripting mostly based on twerking other people's codes
.
I'm trying to check a list of 3.7 million artist names on azlyris and if the artist exists I'm saving his name to a text file.
The way I check if he exists is a little bit unorthodox, I just check if the div on the webpage which has the album list exists and if it does I say he does too, I do this because azlyris accepts pretty much any url that ends with .html and presents some kind of homepage for it instead of a 404.

My script checks it at a rate of 2 entries per second, which would take more than 21 days, I'm using beautifoul soup but I feel this is a little bit too slow, is there any way I could make it faster? I know my code must be horrible to read and a big clustefuck but as I said, I'm pretty much a total noob. It's okay if you want me to just go fuck myself.

The Code:
http://pastebin.com/nzpzBXdS
>>
Can I read raw data from PS/2 keyboard port on Linux?
>>
>>55796620
No.
>>
>>55796620
Yes
>>
>>55796627
How do I do it? I need it for a driver
>>
>>55796620
>>55796627
That's essentially what ckermit and minicom and screen does. Just read from /dev/com<whatever>
>>
>>55796620
Yes.
/dev/input/event* contains shit involving input.
>>
>>55796639
>How do I do it? I need it for a driver
No, see >>55796643

You need to up your Google searching skills.

http://unix.stackexchange.com/questions/42376/reading-from-serial-from-linux-command-line
>>
>>55796613
I get that. Hoped for a convenience but it just wasn't there. Probably have to do some hacks with void* to not keep any duplicate data to do arithmetic.
>>
>>55796677
>\Hoped for a convenience but it just wasn't there.
JUST PACK THE STRUCT YOU FUCKING MONGOLOID
>>
Trying to compile Akalabeth (Ultima 0) on Ubuntu, getting this error which breaks the compilation

sdw.hxx: In destructor ‘SDLWrapper::AudioObject::~AudioObject()’:
sdw.hxx:156:63: error: ‘free’ was not declared in this scope
~AudioObject() { Detach();if (Data != NULL) free(Data); }


Any ideas? The source is here

https://sourceforge.net/projects/aklabeth/files/
>>
What's open-open.com?
I get views on my github shitprojects from there.
Is it a moon rune stackoverflow?
>>
how the fuck do i use leddit's api? i tried whatever is written in their documentation, and it says its blocked because i look like a bot AND AM MAKING TOO MANY REQUESTS. I dont have any problem with the first part, but this is the first time that server ever requested anything from reddit, it says it requests too often. Is there something i missed?

# curl https://www.reddit.com/r/****/new

<!doctype html>
<html>
<head>
<title>Too Many Requests</title>
<style>
body {
font: small verdana, arial, helvetica, sans-serif;
width: 600px;
margin: 0 auto;
}

h1 {
height: 40px;
background: transparent url(//www.redditstatic.com/reddit.com.header.png) no-repeat scroll top right;
}
</style>
</head>
<body>
<h1>whoa there, pardner!</h1>



<p>we're sorry, but you appear to be a bot and we've seen too many requests
from you lately. we enforce a hard speed limit on requests that appear to come
from bots to prevent abuse.</p>

<p>if you are not a bot but are spoofing one via your browser's user agent
string: please change your user agent string to avoid seeing this message
again.</p>

<p>please wait 4 second(s) and try again.</p>

<p>as a reminder to developers, we recommend that clients make no
more than <a href="http://github.com/reddit/reddit/wiki/API">one
request every two seconds</a> to avoid seeing this message.</p>
</body>
</html>
>>
>2016
>Not programming Enterprise Java web based apps for a lot of money

What is your excuse?
>>
>>55797172
Sounds gross
>>
>>55797172
Some of use actually program because it's fun.
Enterprise Java OOP crap is not fun.
>>
>>55797162
change your curl user agent
>>
>>55797183
Enterprise Java OOP can be lots of fun when you build fun exciting web apps you just haven't done it yet
>>
>>55796316
Currently working on a general AI library in C,
right now I am working on the image recognition and detection plugin (users can also write their own plugins to feed the AI) the core is halfway done.

I'll probably put the project on github.
>>
>>55797206
I despise writing shit in Java. It tries to force you into their shitty OOP mindset and feels very stifling overall.
Also, webshit doesn't interest me in the slightest.
>>
>>55796618
It would be faster if you checked the pages containing all the artists like www.azlyrics.com/a.html since what's slowing it down is all the webpage requests. Set it up so it loops through the amount of artists on the page and checks the href against the artist name.
>>
>>55797255
what do you like to program?
>>
>>55797280
I haven't done a huge amount of programming lately, but the last thins that I messed around with was audio manipulation and before that, messing around with Linux's DRM features to try make a wayland compositor.
>>
Wrote a script to search SWF files for calls to JavaScript. Currently running it against 32000 SWFs from /f/.

Manually examining the "bad" files to check for XSS attempts. So far it's mostly just SWFs that use JS to grab the URL for view tracking and SWFs that call a function that doesn't exist.
>>
>>55796873
Add #include <stdlib.h> to the header.
>>
>>55797172
How's your AbstractProxyFactoryFactoryBean treating you?
>>
Dear /g/,

Project ideas for somebody who likes bit-twiddling? To be written in C, C++, or Rust, or possibly Go if it's a problem that's solved by being concurrent as fuck.

Preferably something that doesn't take forever i.e. don't tell me to write a toy operating system.
>>
>>55797485
It's a meme all you really use is a beans class without factories. Java has evolved
>>
>>55797520
Are you allowed to use something that *isn't* XML for serializing your shit?
>>
Anyone here do any data warehousing?

I'm trying to conceptualize my whole ETL structure, and I'm not sure if I'm retarded.
>>
>>55797513
Write an emulator
>>
>>55797540
Yes there is multiple different ways to do it but I personally use XML and find it easy to use
>>
I'm making some headway with understanding requests and JSON within Python, and I guess it's much easier than I thought even though accessing the per-thread JSON was "weird".

rqst = requests.get('https://a.4cdn.org/{}/thread/{}.json'.format(board, thread)).json()

print(rqst['posts'][0]['name'])


That'll return "Anonymous" if I point it at any old thread by an anon; accessing a key called 'posts' that is associated with a list filled with dictionaries for each post in the thread. If I try something like:

pstNum = []

thread = requests.get('https://a.4cdn.org/{}/thread/{}.json'.format(board, thread)).json()
for users in thread:
print(users['no'])
pstNum.append(users['no'])


to get each post number in any given thread, it returns a TypeError (string indices must be integers). What did I skip over?
>>
File: lol_vim.png (125KB, 689x920px) Image search: [Google]
lol_vim.png
125KB, 689x920px
Problem:

Found a useful library that is about 5 years old.

Made some changes, added some things.

Tried to contact developer to merge my changes. His last activity was years ago and he is unresponsive.

At what point can I just modify the hell out of this and post it on my own GitHub? I want to give him credit, which I could do in code, but I also want to revive the project and he's not alive.
>>
>>55797581
what will you do if the server errors out?
i prefer
req = requests.get(url)
req.raise_for_status()
json = req.json() # or json.loads(req)
>>
>>55797603
Depends on what license it is. But most likely you can just put it on your own either way. There is nothing in the GPL/MIT/BSD/etc. that say you have to try and merge your changes upstream, so creating your own repo with it is no problem. It could theoretically be a problem if there's no license on it but if he's not responding about it and hasn't been active in years it's unlikely he gives enough of a shit to lawyer up about it.
>>
>>55797603
Just do it now.

This is kinda the purpose of open source...
>>
>>55797625
>>55797627
Mozilla Public License 1.1

Do I have to keep that License or can I just bring the code over and MIT it?
>>
Making dank YouTube vids in MATLAB

https://www.youtube.com/watch?v=Q_vhIV3_rjw
>>
>>55797565
>but I personally use XML and find it easy to use
Why?

XML is a pain in the ass to edit by hand. One could say that it's more machine-friendly than script-writer-friendly but there's no way, NO way, that XML is easier to parse than, say, .ini
>>
Why is C++ so comfy?
>>
>>55797700
It isn't.
>>
>>55797513
Write your own scripting language and have it JIT compile to machine code.

Alternatively, just write a JIT for somebody else's scripting language. The community will appreciate it!
>>
>>55797639
>Do I have to keep that License or can I just bring the code over and MIT it?

You'll probably have to keep the license. Take a look at its terms.
>>
>>55797712
It is.
>>
>>55797700
what kind of stuff do you program that you think it's comfy?

also, how autistic are you?
>>
>>55797613
I mean that doesn't answer the question at all but thanks I guess, I'll change the way I request the JSON down the road when I actually get a grasp on utilizing the stuff in it.
>>
>>55797603
Obviously, you can do whatever the license permits. Especially since it sounds like there's no active development of the project.

I ran into the same thing and I decided to just rewrite the whole thing, although I learned from the methods in the old code. I noticed that others did the same and started many new projects around the same idea.
>>
>>55797639
>Do I have to keep that License
Yes, always, regardless of license, at least for the original code. Without the license, by default (due to copyright law), you have no right to distribute someone else's code.
The final result (application, whatever) can be released under another license, provided doing so doesn't violate any of the parts licenses. In your specific case (MIT for the entire thing with MPL1.1 parts) this is not possible because MPL1.1 is a weak copyleft license (ie. it has source code availability requirements that the MIT doesn't).
>>
>>55797765
>>55797908
>>55797946
Got it, blatant plagiarism it is.
>>
>>55797821
Right now I'm making a game

I contracted autism when I fell for the avian flu meme
>>
>>55797263
Wow nice suggestion thanks
>>
>>55797808
>language silently destroys data with implicit conversion of numeric types to types that hold less data

No, thanks.
>>
is the unix programming environment still worth reading?

the code examples predate ANSI C
>>
>>55797955
Not plagiarism, this is what the developer allowed you to do. Anyways, if you create a fork don't use the same project name. Also, this can be helpful:

https://www.mozilla.org/en-US/MPL/2.0/FAQ/
https://www.mozilla.org/en-US/MPL/2.0/combining-mpl-and-gpl/
>>
I'm relearning Java for a new job. Haven't touched it since the Spring 2015 semester, so I'm kind of relearning from scratch.

Start work in 2.5 weeks or so. Hoping to not be shite.
>>
>>55798302

It's Java. As long as you're more skilled than Pajeet, you'll probably be alright.
>>
>>55798295
>MPL/2.0
2.0 and 1.1 are not the same thing
>>
>>55798295
>Not plagiarism, this is what the developer allowed you to do.
I've modified the source code, and now I'm forced to release it under MPL if I distribute it.

I'm going to re-write most of it and just release it under MIT.
>>
>>55798352
My team is all white from when I met them at the interview.

Hopefully that's still true.
>>
Why do so many people act like Haskell is the only good programming language?

It's such a fucking meme and it's so pretentious to shit on every other language and then talk about how great Haskell is.
>>
>>55798433
It's one or two Hasklel autists that spam, anon.
>>
>>55798433
Haskell gets just about every design decision right.

Other languages do not.
>>
>>55798390

Did they go to good universities?
>>
>>55798433
it's a meme

there's a reason why FP never took off
>>
>>55798463
Two from Penn State (same as me), one from a trade school, and I can't recall the other three. The college graduates all have B.S. in IT or CS.
>>
>>55796550
>>55796592
>>55796597
>>55796600
>>55796613
There are CPU architectures and programming languages that allow bit aligned access.
>>
File: 1467877306358.jpg (39KB, 600x489px) Image search: [Google]
1467877306358.jpg
39KB, 600x489px
I wanna do some shiet with lambda calculus in Haskell.

Any recommendations for books or youtube tutorials?
>>
>>55798493
>bit aligned
you don't know what the fuck you're talking about
>>
>>55797162

Fake the user agent and you can do whatever you want
>>
>>55798498
1. stop being a frogposter
2. use google
>>
How do i find the smallest integer that's a multiple of a floating point number?
>>
>>55798515
Data in C other than individual bit fields is "byte-aligned." The original MIPS required data to be "word-aligned." Some CPUs allow "bit-aligned" (sometimes called "1-bit-aligned") access to data. This means the CPU can address data at a bit address instead of only a byte or word. Pointers on these architectures point to individual bits.

You can do that on other CPUs too,.but you would need bitfield instructions or shift and mask, like you need on the old MIPS when reading and writing non-word-aligned data.
>>
>>55798792
post your code. i need context
>>
>>55798819
>Data in C
>byte-aligned
sounds like you don't know C
>bit-aligned
there's no such thing
>This means the CPU can address data
no, alignment doesn't mean that; you don't know what the fuck the words mean
>>
Returning to university to finish my CS degree (1.5 years left) after 2 years of depression and NEETdom. I feel like I learned a lot over those 2 years though so I'm partially worried university will end up being a waste of my time.

Anything I should watch out for? Maybe it'll be fine if I get into undergrad research this time.
>>
>>55798855
>there's no such thing
http://lmgtfy.com/?q=%22bit-aligned%20data%22

Universities in India might not teach that. I've never been there.
>>
>>55798825
I don't have any relevant code yet.

The context is that for a given sound frequency and a given sample rate, i want to know exactly how many periods of the sine wave are needed to for the wave sample to repeat themselves.
>>
>>55798792
>the smallest integer that's a multiple of a floating point number
So...one?
>>
>>55798902
>lmgtfy
top fucking kek, you got rekt by your own argument
>>
>>55799003
one is not a multiple of, say, 0.3
>>
>>55798792
Depends on what you mean. Do you mean smallest integer multiple where f*a=i where f is the floating point number and a and i are integers?

or do you mean smallest integer multiple where f*a=i and a is any number?

in the latter >>55799003

In the former it would depend on whether or not f is a real or irrational number. Of course, it's floating point so that alone forces us to assume it's a real.

I think doing it optimally might require a little math prowess. let me see if i can find a theorem or sketch out a proof for something to help optimize it
>>
>>55798792
powers of twos and fives until you get enough zeros
>>
>>55799003
-1
>>
>>55798792
Multiply it by 2 until it's a whole number.

Be prepared for wait times of a few weeks.
>>
programming a friend since they're too difficult to aquire irl
>>
>>55799152
fyi, there's a thing in python that can chat with you

it's part of some NLP package
>>
>>55799167
import friend;
>>
>>55799119
>f*a=i where f is the floating point number and a and i are integers?
Yes, this. And in fact i want to find the smallest a, instead of the smallest i, but those are equivalent problems.

>Of course, it's floating point so that alone forces us to assume it's a rational.
Fixed that for you. The reals is the union the rationals and the irrationals.
>>
>>55798792
Look at the amount of numbers behind the comma, then multiply it with that number.
>>
>>55799152
I am programming a waifu.
>>
is it bad coding style to have a single action listener with actions of various components (button, combobox) in java?

like right now my overall class implements actionlistener and within i have an actionPerformed that handles a bunch of different components. but would it be better to have multiple inner classes for the different types of components instead?
>>
>>55799206
Correction, multiply it by 10 to the power of that number.
>>
File: programming language waifu.png (1MB, 4047x538px) Image search: [Google]
programming language waifu.png
1MB, 4047x538px
let's make a better lang waifu chart
>>
>>55799225
smallest, you idiot
>>
>>55799206
Yes. How to code this?
>>
>>55799206
>>55799225
Ah wait, nevermind that's stupid.
>>
>>55799235
do your own homework, buddy
>>
>>55799196
>>Of course, it's floating point so that alone forces us to assume it's a rational.
>Fixed that for you. The reals is the union the rationals and the irrationals.
tak. slip of the mind.
>>
File: FizzBuzz.png (13KB, 578x461px) Image search: [Google]
FizzBuzz.png
13KB, 578x461px
>>55799229
Why is haskell a guy?
Where's MSWLogo?
>>
>>55799206
>behind the comma
Communist.
>>
File: what.png (30KB, 1158x190px) Image search: [Google]
what.png
30KB, 1158x190px
what the fuck

I doing a my first thing in c++, written in many languages but never in this shit.

I made one project with all the shit. Then I needed to expose some stuff so addons could be made and shit. Made another project, lib.h in include folder, the lib.h is exposing types:
#include <../a.h>

DLL_EXPORT typedef a a;


the implementations are in the first project. Implementation of one class 'works', another one gives me a fucking 'does not name a type'. Even better, when I commented that implementation file, I got pic related in runtime. On a fucking type::type(void){}

WHY?
>>
Is there any jobs market for distributed systems or AI? Those are my main interests.
>>
File: 9NjEfU7.png (23KB, 673x456px) Image search: [Google]
9NjEfU7.png
23KB, 673x456px
It's raining here and I have unlimited coffee and donuts.

Anyone else comfy?
>>
>>55799367
Distributed systems is pretty hot right now, isn't it?
>>
>>55799367

No there is nobody at all interested in AI since it has zero real world applications
>>
>>55799385
why did you upload this to Imgur?
>>
File: ?.png (7KB, 120x120px) Image search: [Google]
?.png
7KB, 120x120px
Does anyone know how can i convert a .bdf font to .ttf font?
>>
>>55799385
you're working a shitty CRUD job

that's kill-yourself tier
>>
>>55799466
Quick upload screenshot tool.

Auto-copies link to clipboard after capture, easier to one-click post to 4chan than drag/drop from file explorer.
>>
>>55799479
>implying I don't get off to CRUD

It's easily my favorite type of project.

Working with databases and APIs and creating visualizations summarizing the data makes me moist.
>>
>>55799416
>No there is nobody at all interested in AI since it has zero real world applications
hmmmm
>>
>>55799484
>Sharex
You could honestly just have a script take a screnshot and just copy the filepath for you
>>
> get 9-5 programmin job
> enjoyment wittles away and want to an hero
> gotta eat and pay rent so can't quit

No one told me being an adult sucked this much dong, qq
>>
>>55799540
ShareX has a fuckton of features that I use pretty often.

Drag-and-capture webms are really nice.
>>
>>55798792
>>> from fractions import Fraction
>>> Fraction(str(0.1)).numerator
1
>>> Fraction(str(0.12)).numerator
3
>>> Fraction(str(0.125)).numerator
1
>>> Fraction(str(0.126)).numerator
63
>>
Why doesn't scheme the same nil as common lisp?
What the fuck are you supposed to return on function that don't return value a fucking #f?
Like what the fuck are scheme programmers as fucking faggot like as php programmers?
>>
File: pajeeeeet.png (4KB, 295x106px) Image search: [Google]
pajeeeeet.png
4KB, 295x106px
>>55799573
>you will never get mad to the point of incoherence at a programming language
>>
>>55799310
because you don't know what the fuck you're doing; learn the language first
>>
Programming God here ask me anything
>>
>>55799689
How do I learn everything there is to know about Haskell?
>>
>>55799689
Why are you raped so frequently on this board?
>>
>>55799705
program Haskell and read programming books watch programming videos everyday for 2 hours
>>
>>55799689
When will Prelude be fixed?
>>
>>55799654
I may not know the language entirely, but I know well what I want to accomplish
too bad I couldn't find ANY examples of stuff that is in any way similiar to what im trying to do
>>
>>55799773
working as intended
>>
>>55797172
I vomited a bit in my mouth upon reading your post senpai
>>
How do i make a software for converting files
Like pdf to doc and etc.
>>
>>55799999
Nice quints.

You use libraries.

If you really want to do it yourself, you must be intimately familiar with how both file-types are constructed. From that point, you perform fucktons of logic to convert the concept of an image or piece of text in one filetype to how the next filetype is expecting it.
>>
>>55799415
There doesn't seem to be much such work in Finland

It's mostly just webdev and enterprise CRUD crap
>>
File: do something productive.png (196KB, 500x750px) Image search: [Google]
do something productive.png
196KB, 500x750px
I need ideas for a project. I mostly use Java because I'm a huge fag. I'm not looking for something really easy or really hard, just something to keep me busy for a few days.
>>
>>55800071
Game of life with GUI, it was my first Java project when I started.
You can add more and more features until you get tired
>>
>>55799573
It still has nil. It's just spelled '() for some reason.
>>
>>55796316
Who /machinelearning/ here?
I'm taking a week off uni and I'll start to work on some neato challenges after that, but I'm worried that I'll run out of ideas after those
>>
I'm writing a scraper that pulls http file URLs for downloading. I can either use in-Python libs to download the file or somehow pipe the URLs to a separate download manager, say Free Download Manager. I want to do it in Python but their libs suck, no multipart DLing, no pause&resume, no saving temp files, plus no GUI. But I don't know of any DL managers that supports interaction from and to python. Any ideas?
>>
>>55800161
what are you going to work with?
>>
>>55800161
>I'm taking a week off uni

this is how it starts
>>
File: ANIKI.png (226KB, 468x345px) Image search: [Google]
ANIKI.png
226KB, 468x345px
>doing a technical test for my first job
>work out the one thing i was missing 5 seconds after the timer stops
why live
>>
>>55800161
i tried getting into tensorflow but couldnt really get started
>>
>>55800096
I have no idea where to even start for making a game of any sort. I know nothing about GUIs or graphics at all.
>>
>>55800199
Tensorflow and scikit-learn (which I never used) or MATLAB

>>55800220
>what is summer
>>
>>55800230
should've said
>>
>>55800071
FizzBuzz
>>
File: giphy[1].gif (2MB, 625x352px) Image search: [Google]
giphy[1].gif
2MB, 625x352px
 if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if if 


I consider myself fairly adequate at Python scripting
>>
>>55800271
Okay Obama
>>
File: 1466577279086.png (71KB, 780x530px) Image search: [Google]
1466577279086.png
71KB, 780x530px
>>55800271
you're supposed to be doing it the Python way, which is to use exceptions rather than if
>>
>>55800253
it was an online one
all it required was 3 lines of code
feels bad
>>
>>55800040
Thanks, i just wanted some small guidance before i figure out for myself
>>
>>55800309
>3 lines of code
nigga... what was the test and how much time did you get?
>>
>>55800340
the test was writing fizzbuzz in one line.
i just forgot one thing
>>
>>55800366
>the test was writing fizzbuzz in one line.
God fucking damn it.
>>
>>55800366
literally why

should've just done a readable fizbuzz then removed all newlines
>>
>>55800340
I don't mean the whole test was 3 lines, i mean the thing i needed was only 3 lines

all i had to do at the end of a fairly long task was iterate over 2 arrays of characters and increment a number when they didnt match
my mind completely blanked out over something so simple and i forgot to put it in
>>
>>55800405
Usually one line means one statement.
>>
>>55800405
he's yankin yer chain
>>
File: tokyo-b-tree.png (37KB, 235x219px) Image search: [Google]
tokyo-b-tree.png
37KB, 235x219px
What does /dpt/ think about key-value stores?
>>
>>55800448
they exist
>>
>>55800448
i fux wit em heavy
>>
>>55800448
NoSQL is a meme
>>
>>55799220
If you're on Java 8 you can use method references in place of ActionListener implementations since the latter are functional interfaces:

public SomePanel () {
... cancelButton.addListener(this::doCancel);
...
}

private void doCancel(ActionEvent e) {
System.out.println("benis");
}


But what you're doing is acceptable. You could also make a nested class that implements the listener(s) you need.

Note that method references ONLY work with functional interfaces, ie. not MouseListener because it has multiple methods.
>>
>>55800498
No, SQL is a meme
>>
>>55800498
SQL RDMS's use that for indexing, for what it's worth.
>>
>>55800498
why?

please explain with reasonable arguments
>>
Why must Java be so verbose?

Fuck this.
>>
>>55800550
Just abstract things out.

Some verbosity can be a good thing, depending on where it is.
>>
>>55800550
Because making languages that are not verbose is hard.

For example if you want to not have to mention every type twice when declaring something
List<Dog> doglist = new List<Dog>()

you need your compiler to be able to do type inference, meaning perform the algebra on all types of the program and be able to fill out any blanks you leave in.

I guess the question is like "why are some applications hard to use" - because making them easy to use is difficult.
>>
for i in range(1,101):
if i%15==0: print("FizzBuzz")
elif i%5==0: print("Buzz")
elif i%3==0: print("Fizz")
else: print(i)


i cant seem to find a way to do it without some kind of redundancy (%15 in this case)
>>
>>55800576
for i in range(1,101):
print"FizzBuzz"[i*i%3*4:8--i**4%5] or i
>>
>>55800550
More verbose the better you know exactly what you are doing and reading the code makes it is easier in Java like english. Java is pretty much reading english
>>
>>55800595
needs to be one line
>>
>>55800550
Because IDEs exist to eliminate most of the extra typing, and verbose code is easier to grok at a glance than bullshit like strrstr.

Granted, getters/setters and are the fucking worst.
>>
>>55800596
>Java is pretty much reading english
no
>>
>>55800638
c was designed in a time before autocomplete

when you had to type everything out, you were fucking glad that all the function names were 3 characters long.
>>
>>55800638
getters and setters make programming so much easier and you can have it done automatically done for you in Netbeans or Eclipse quit your whining weenie
>>
Is Scala any good?
>>
>>55800628
for i in range(1,101):print"FizzBuzz"[i*i%3*4:8--i**4%5] or i
>>
>>55800668
It scales good
>>
File: 1468877540019.jpg (179KB, 512x512px) Image search: [Google]
1468877540019.jpg
179KB, 512x512px
Do you guys ever write anything useful, or do you just masturbate over language syntax and bikeshed all fucking day?
>>
>>55800655
I realize. It's {{current_year}} now, though, and character-count is the least of my concerns when evaluating a language.
>>
>>55800695
i asked a real question >>55800194 and no one answered, so i guess the masturbation thing
>>
>>55800695
I write useful java applications
>>
>>55800718
such as?
>>
>>55800695
Do you?
>>
>>55800194
>>55800717
Your project is masturbation-tier and your question shows a lack of understanding in how a data library works vs. a GUI framework.

If you have a library that processes audio data, it's unlikely that it will come with it's own GUI. In the same respect, many GUI frameworks have audio controls, but they are simply there to send and receive data from your underlying code.
>>
>>55796316
something that I can't see unless I write a bit of code then have to rest for about 12 hours , then attack it again (currently) ... have sketched out a framework but have to write code to see it implemented -- so far I have had 2 sessions 2nd session, I saw all the problems, so the nxt session (tomorrow) should nail it. Spent some time after todays session getting code back to state where it can be progressed into session 3 (today I broke it all completely)
>>
>>55800668
If you have to work on the JVM it's probably the comfiest language
>>
>>55800695
I write useful things in C#.

That's why I get paid to do it.
>>
>>55800695
once in a while someone actually posts something they're working on
sometimes a newbie comes in and asks for help
this, however, is rare
most of the time, /dpt/ is "MY LANG > YOUR LANG", memes, and other various shitposting
>>
>>55800728
productivity business web apps for your small to medium sized businesses
>>
>>55800695
I write useful things in Haskell, and I get paid doing it
>>
>>55800761
so nothing of relevant. got it.
>>
>>55800742
can only see it all when rested, which = after a full night of watching films or reading or upon waking up ... always on waking up. Code/systems should just flow - after all it is writing .. if it 's not flowing (you are not consistantly typing happily, to develop a framework), then the framework is flawed. Doing that causes you to burn out fast - otherwise, you're happy & it's entertaining
>>
>>55800668
It's shit. Avoid the JVM at all costs.
>>
>>55800780
define "relevant"
>>
>>55800789
define "productivity"
>>
>>55800658
They clutter up classes, though, and there's better ways to deal with them (C#/Kotlin's properties, Ruby's attr_accessor method). There's Lombok but code generation is icky.

And it's fucking insane that chainable setters (ie. setters that return the object they're invoked on) aren't valid properties to BeanUtils.
>>
>>55800761
What language/major frameworks?
>>
>>55800801
I can't give away my specific niches which make a lot of money sorry
>>
>>55800713
>It's {{current_year}} now, though
You forgot the $ before your interpolated string, anon.
>>
>>55800817
lmao ok
>>
what if I wrote my own fizzbuzz library?

import fizzbuzz
fuzzbuzz()
>>
>>55800754
c#? you're not a programmer
c# is a toy
>>
>>55800741
you're right, but obviously im not gonna write a GUI for the python libs when most likely there's already ones that does everything that i want to do. i'm looking for one and can't find it.
>>
>>55800804
Java Spring Framework
>>
>>55798302
You'll be fine. It's Java so you'll only be competing against people that are too stupid to get jobs in other languages. There isn't a single good programmer alive that wants to program in Java.

You'll probably also be using Spring so nobody will really understand how anything works and bullshitting your way through everything is easy.
>>
>>55800817
>damage control
top cuck
>>
>>55800777
What kind of things
>>
>>55800777
ahahah
>>
>>55800832
>>55800862
it's true once you find a specific problem to a very specific niche market you never ever tell anyone and that way you will make lots of money from programming
>>
>>55800288
Jesus christ I hate people that use Python. It's objectively one of the worst dynamically typed languages. Just one big disgusting dict hack.
>>
>>55800915
i hate people that hate python
>>
>>55800849
(You)
>>
>>55800847
fuzzbuzz(64)


To do it up to 64
>>
>>55800928
Then you're in the wrong thread
>>
>>55800915
>Why do Americans pronounce it as Py-fawn?
>>
>>55800902
>muh fizzbuzz
sure thing
>>
>>55800940
Didn't mean to greentext, sorry
>>
>>55800572
Local type inference is incredibly easy to implement. C#'s implementation with var isn't even a hundred lines of code.

Entire program type inference is what's hard but absolutely nobody has suggested that for Java.
>>
>>55800939
you what?
>>
>>55800695
I wrote a Discord bot for a friend's mod team that posts SVN commit notifications in a channel, and made it configurable with an interface on my site. Got to use a bunch of web programming shit I'd never messed with before, like OAuth for verifying ownership of the Discord server.

Thank Christ for Bootstrap though because I hate trying to make web shit pretty.
>>
I have windows 7 should I upgrade to windows 10? What if I don't upgrade?
>>
>>55800940
>Why do Americans pronounce it as Py-fawn?
I've literally LITERALLY never heard someone say this.
>>
>>55800985
>>>/g/sqt

Why do we get so many /sqt/ cross-posters?
>>
>>55800985
Your house will be stormed by a small army of poos that will forcibly install it on your machine.
>>
>>55800986
but you never leave your basement, though
>>
>>55800986
Look on Youtube, literally everyone does it.
>>
>>55800695
Writing a renderer for a graphics engine. Though, video games aren't useful, so no, nothing useful.
>>
>>55800878
a whole internet of things
>>
>>55801023
Mathematical things?
>>
what can't java do that c++ can ?
>>
>>55800658
> Why have properties that are verified by the compiler when the IDE can generate tons of boilerplate or we can rely on annotation and code generation hacks?

Java developers are so fucking stupid it's unreal. The day Google deprecates this garbage will be the best day of my fucking life.
>>
>>55800860
Sounds terrible. I'd rather do hard manual labour.
>>
>>55801069

Pointers
>>
>>55801079
No Java developers are smart we use the tools to work for us not work really hard typing all that stuff which makes Java not verbose at all
>>
>>55800777
No you don't.
>>
In C, does const in a function's parameter list mean (A) that the parameter will not be changed within the function or (B) that the arguments passed to the function will have to be const at function call's scope?

If the situation is (A), then why does gcc say
note: expected ‘const struct bucket_list * const* const’ but argument is of type ‘struct bucket_list **’
void * bl_get(bucket_list const * const * const list, char const * const key)


When bl_get doesn't alter **list at all?

bl_get is a simple element getter for a linked list:
void * bl_get(bucket_list * const * const list, char const * const key) {
if(NULL == list) {
perror("list was empty");
return NULL;
}

bucket_list const *curr;
for(curr = *list; curr != NULL; curr = curr->next) {
int cmp = strcmp(key, curr->key);

if(0 == cmp) {
return curr->value;
} else if (cmp < 0) {
return NULL;
}
}

return NULL;
}


If the situation is (B), then the problem above is explained since I'm calling the function with non-const bucket_list structures, but then I don't understand why there's not a similar warning when I call strcmp, whose prototype is
int strcmp(const char *s1, const char *s2);
, with a char * (NOT char const *), like in:

char *str = malloc(1024);
memset(str, '\0', 1024);
scanf("%s", str);
strcmp(str, "this should raise a warning");


Tell me why neither (A) nor (B) are the case and why I'm stupid (or, alternative, tell me that my compiler is broken).
>>
>>55801069
template <template <typename> typename Temp>
using spec = Temp<int>;
>>
>>55801099
but it uses implicit pointer with new ...
>>
>>55801124
Obvious mistake, in the second code tags it should be

 (...) bl_get(bucket_list const * const * const, (...) )


The first const is missing.
>>
Babby here.

# rqst = requests.get 4ch api json link
for items in rqst:
for usrPosts in rqst['posts']:
pstNum.append(usrPosts['no'])


This jus werkz and a following print statement prints out the list; success. Dare I add:

imgNum.append(usrPosts['tim'])


to it or make an entirely separate loop for it and comment out the previous loop, I get a KeyError despite following the same idea. 'tim' doesn't work if I put it in the first loop either, but similar keys like 'filename' don't work as well. Meanwhile, 'now' returns everything exactly (date, day, time of post). The keys 'tim' and 'filename' exist within the JSON and I've accessed other keys within. I tried rqst.keys() to see what I was looking at within the loop, but it only returns 'posts' as a key. Why?
>>
>>55801141
Depends on what you see a pointer as.

It's not a reference to a specific place in memory. It's a reference to where an object is in the JVM.

The JVM can move that object wherever it pleases in memory.

Can't do math on the memory address.
>>
what's the absolute best site/book for a total beginner to learn Python?

I only suggested Python to this woman because it's simple and versatile, and she can make stuff happen, I already got her doing a bit in termux on her phone and she managed it (she doesn't have her own computer because she's poor as fuck)
>>
>>55801069
Be memory efficient. How is it possible that a statically typed language still doesn't have value types and efficient structs? Proper value types are getting delayed again to Java 11 which isn't expected until 2022. This is just pathetic.
>>
>>55801157
all posts have a post number associated with them, but not every post has an image attached, hence not every post has a tim
>>
File: b8LXIs7.png (19KB, 283x648px) Image search: [Google]
b8LXIs7.png
19KB, 283x648px
>>55801157
Because 'posts' is the only object at that level of the JSON

no is an attribute of a post.
>>
>>55801187
But java does have value types.
>>
>>55801115
You sound retarded. I hope C# crushes you fucking faggots.
>>
>>55801069
Once you go from Java to C++, you don't go back.
>>
>>55801209
Java will always be on top. Stay mad C# cuck
>>
>>55801205
No it doesn't.

http://cr.openjdk.java.net/~jrose/values/values-0.html

There's the proposal and it won't see the light of day until Java 11 at the earliest.
>>
>>55801174
>Can't do math on the memory address.
that's not proper C++ style anyway, you use iterators
>>
>>55801209
>I hope C# crushes you fucking faggots.
In my mind, it already has.

I'm never going back to Java. There's no reason to, outside of needing to for a specific job.
>>
inb4 C-Shart guy is summoned
>>
>>55801232
The question was not what should be done. It was what can be done.
>>
>>55801233

C# is liberating.
>>
>>55801219
I heard that one before

so you're really fucked like never before ?
>>
>>55801236
There are a few anons that use C# here, that I've seen.
>>
>>55801232
>proper C++ style
Fuck off commie
>>
>>55801269
C# is actually a decent language while Java is shit.
>>
>>55801227
I'm not going to read your link because this is something very clear. There's either a misunderstanding here (etiher you mean "why is java lacking in value types and forces almost everything to be an object with the costs associated to objects", which is not the same as saying it doesn't have value types, or you disagree on the definition of value type and think int, boolean, etc aren't value types) or you're baiting.
>>
>>55801252
but obviously we're talking about limitations that matter
>>
>>55801124
>>55801155
Calling attention to these posts

Someone here has to know the answer to this question. It should be fairly obvious to anyone who uses C often
>>
>>55801277
don't blame me, I didn't design the STL
>>
>>55801291
pointers are iterators
>>
>>55796534
why do you need it to be equivalent?
>>
>>55801261
Interracial love is liberating
>>
>>55801288
Nobody cares about your pedantry faggot. Java doesn't have user defined value types and that's absolutely pathetic for a statically typed language.

Go back to Spring or whatever god awful cluster fuck you work on.
>>
>>55801312
iterators are not always pointers you can do math on is the point
>>
C# or Python for first language?
>>
I'm creating a self-hosted app that needs to be able to store persistent data.

What should I use in order to make self-hosting and setting it up as simple as possible?

I started out with Postgres but it's not good since it requires configuration.

Maybe sqlite? Rolling my own if the data is simple? Something else?
>>
>>55801330
but pointers are always iterators
>>
>>55801335
C# and Ruby for scripting.
>>
>>55801335

Java
>>
>>55801327
See, this is why no one takes /dpt/ seriously. I just corrected you and you lash out like a little sperg. I'm not defending Java (not that there's anything to defend, it's a language like any other, if it doesn't gel with you then don't use it), I'm just stating you were wrong, prick.
>>
>>55801335
D
>>
>>55801335
c# is more of a real language
>>
>>55800820
It's a text template, anon.
>>
>>55801335
Both are great for a first language.

I say C#.
>>
>>55801335
Python. C# is full of complicated extras.
>>
>>55801365
ummm, F*CK OFF?!?!
>>
>>55801352
which you're not supposed to use because you read the books and learned the STL
>>
>>55801387
Did I anger you?
>>
>>55801378
>C# is full of complicated extras.
Out of all the arguments I've seen, this always cracks me up.

>It has too many useful features!
>>
Can we all agree you should start a scripting language such as Python or Javascript before getting into any of the more complicated ones like C or Java so you will have a better understanding of how to actually program?
>>
>>55801396
you made me horny
>>
>>55801362
>it's a language like any other
>best tool for the job

Retarded platitudes aside, it's shit though while many other languages are not.
>>
>>55801413
No, kill yourself.
>>
>>55801378
>complicated extras
at least it's productive and not just ten times more complicated for no good reason like c++
>>
I was messing with Unity the other day and noticed it uses C#.

How hard is it to learn C# outside of Unity?

It looks like Java to me in how its organized.
>>
>>55801429
It's not being the best tool for the job, it's being the best tool for a certain user to user for a certain job. Let's not kid ourselves, 99% of jobs that a static C-like language can do, so can any other. What matters most is the user's familiarity with the language and personal taste.
>>
>>55801447
C# is very similar to Java with more sanity in the syntax, and lots of convenient things built-in to the language.

Overall, not as easy as something like Python, but still very easy to learn.
>>
>>55801397
You're not thinking like someone approaching programming for the first time would.

Let's read a hello world:
// A Hello World! program in C#.
using System;
namespace HelloWorld
{
class Hello
{
static void Main()
{
Console.WriteLine("Hello World!");

// Keep the console window open in debug mode.
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
}
}
}


What is a namespace?
What does using mean?
What is a class?
What does 'static' mean?
What does 'void' mean?
What are the '.' (dots) for?
Why the funny bracket things?

print("Hello world")
>>
>>55801335
x86-64 Assembly
>>
At what point should I look up the solution?
been working on a codeforces problem with no avail
>>
>>55801481
don't worry you will learn those later
>>
>>55801481
>What is a namespace?
>What does using mean?
>What is a class?
>What does 'static' mean?
>What does 'void' mean?
>What are the '.' (dots) for?
>Why the funny bracket things?
all things you have to learn anyway and books teach it very well

at least you're gonna be a competent programmer by the end of it and not just a script retard who thinks he can program
>>
>>55801522
script programming and high level programming are the same thing
>>
>>55801481
I never once said that C# is "easier" than Python.

I simply think it's better for a first language.

It's also worth noting that the procedure for creating a Hello World console application is much simpler than you're trying to make it out to be.

VS -> New Project -> Click OK ->
Console.WriteLine("Hello World");
;

Or you can have new projects automatically add
using static System.Console;


And then you can just do
WriteLine
>>
>>55801522
>a script retard who thinks he can program

How do I know if I am this?
>>
>>55801203
I've been staring at previous output in my console, and it looks like I'm getting a list of JSON entries, those entries containing attributes like 'no'; I'm assuming that I'm accessing a key called 'posts' to get a list of JSON entries (since I can access posts with a statement like
print(rqst['posts'][0]['tim'])
)?

I'm not clear on why the loop was able to get all of the post numbers in the first place if "'posts' is the only object at that level of the JSON" - what does it take to consistently access all of the attributes? Apologies for rockbrain but I've been mucking through this for a day or two to try to utilize what I've read.
>>
Guys I may be onto something...

https://ideone.com/B5CM12
>>
>>55801481
>What is a namespace?
Looks like a main.java lookalike to me.
>What does using mean?
Using is similar to Java's import to import different libraries.
>What is a class?
A Class is similar to a function, in which is contains logic or information to be used elsewhere.
>What does 'static' mean?
Static means the logic or information therein cannot be accessed from the outside.
>What does 'void' mean?
Void means it cannot return information or logic.
>What are the '.' (dots) for?
'.' is how you string together libraries and their functions. Console.WriteLine goes into the Console library and uses the WriteLine function.
>Why the funny bracket things?
{} is used to separate parts of code to keep it logical. Sometimes you don't need them, but most of the time you do.

I REALLY hope I just responded to a troll post.
>>
>>55801559
If you have to ask...
>>
NEW THREAD!

>>55801574
>>
>>55801559
you have no idea what the fuck is happening when you run your program

and I'm not saying every C# an java programmer knows it exactly but at least they have a decent idea
>>
>>55801559
If you think Python is good.
>>
>>55801572
you didn't actually read the post did you
>>
>>55801378
>>55801522
>>55801553
Nobody is going to be producing worthwhile code if they only know one language. In this case, python is didactically very useful, because it's a toy language with very simple semantics.

>>55801509
>>55801572
Those questions are ones asked by typical new programmers. I'm not actually asking those.
They're being used to illustrate the difference in languages for learning.


>>55801559
Evaluate thyself: http://sijinjoseph.com/programmer-competency-matrix/
>>
>>55801603
> toy language with very simple semantics.
the problem is that it doesn't teach you how to program

of course you should check it out with its libraries at some point, but if you want to become a real programmer you should start with the real thing in my opinion

and realize that it's difficult but it's the real thing
>>
>>55801326

That, too.
>>
>>55801481

Fact: You don't need to use a single class to create a C# program.
>>
>>55801691
Learning basic control flow with a whole bunch of other crap in the way that you don't understand at the same time doesn't really make you a better programmer.

Spend a day or two on the basics in python, then move over once you're happy.

>>55801743
In which standard?
>>
>>55801756
>Learning basic control flow with a whole bunch of other crap in the way that you don't understand at the same time doesn't really make you a better programmer.
books for beginners explain all that to you very well, no need to worry

how much time do you want to pend on control flow anyway?
>>
>>55801562
>>55801202
if the post doesn't have an image attached, it won't have a tim
>>
>>55798792
>>55799119
>>55799277
I think this should work. Example using 1.212:
0. Drop the value to the left of the decimal
1. Convert to fraction: 212/1000
2. Find gcd of the numerator and denominator gcd(212,1000) = 4
3. Divide denominator by gcd: 1000/4 = 250

1.212 * 250 =303
>>
>>55797581
try this
for users in thread['posts']:
print(users['no'])
>>
god dammit, why wont c++ let me reinterpret_cast<int>(float)
>>
>>55802410
because you're not casting pointer types
>>
>>55802524
yes, i know

instead i have to do silly things like
*reinterpret_cast<int*>(&float)

and that's if the cast argument isn't an rvalue, in which case everything goes into silly shit overdrive
>>
>>55802762
>i have to do silly things
>have to
>>
>>55802888
i'm all for learning new things if you have any better ways of doing things
>>
>>55802965
>*reinterpret_cast<int*>(&float)
name one good reason to have to do this

unless you just want to fuck with C++ like a beginner C programmer
>>
>>55803053
in which case you can just use C syntax btw
>>
Anyone else just write all of your code in a single file and separate it later?
>>
>>55803053
i was trying to bitmask the mantissa
see if i could get some better arithmetic precision than 3.f - floor(3.8008135f)
>>
>>55803309
>3.f - floor(3.8008135f)
3.8008135f - floor(3.8008135f) even
Thread posts: 337
Thread images: 17


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