[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: 322
Thread images: 45

File: IntelCodeTablePreview-1.gif (175KB, 1283x1800px) Image search: [Google]
IntelCodeTablePreview-1.gif
175KB, 1283x1800px
Intel Opcodes because I couldn't find anything else to use Edition

What are y'all working on?

thread->prev: >>60148976
>>
stop wasting time, /g/
you know what to do.
>>
idea guy here

progressive programming language where all values are equal
>>
File: dlang_chan.jpg (139KB, 470x545px) Image search: [Google]
dlang_chan.jpg
139KB, 470x545px
Threadly reminder that dlang-chan is not dead, and she's super duper cute and fast! Say something nice about her, /dpt/!
>>
redpill me on CISC vs RISC
>>
>>60154956
>redpill me
>>>/pol/
At least stay in your containment board.
>>
>>60154961
no bully pls!!!!
>>
>>60154961
bluepill me on CISC vs RISC then
>>
>>60154961
You just confirmed my suspicion that you along with most of this thread are straight from reddit. He wasn't even stating a /pol/ opinion, you have to go back.
The word "redpill" has nothing to do with a 4chan board. A non-retard would know this.
>>
>>60154984
You are either ignorant or new yourself, friend. You're correct that the phrase "redpill me" did not come from /pol/, but /pol/acks used it quite a lot such that they've essentially co-opted it as a board. Thus any anon who uses this phrase is most likely a /pol/ack, I rarely see "redpill me" on the smaller boards where newfags don't visit.
>>
>>60155070
I really hope you're just pretending to be retarded.
>>
File: 1479065309217.jpg (44KB, 398x370px) Image search: [Google]
1479065309217.jpg
44KB, 398x370px
>>60155096
Nice argument. I bet you're from /pol/ too.
>>
>>60155105
So you're not pretending to be retarded?
>>
File: 1489361221939.png (496KB, 780x720px) Image search: [Google]
1489361221939.png
496KB, 780x720px
>>60155070
>friend
I'm not your friend. Someone who shits on /pol/ for any other reason than it being a mostly leftist board doesn't deserve to address me like that.
>You're correct that the phrase "redpill me" did not come from /pol/
I'm glad you acknowledge basic facts.
>but /pol/acks used it quite a lot such that they've essentially co-opted it as a board
This contradicts what you previously agreed with. If the phrase doesn't come from /pol/ and its usage in that context isn't related to /pol/, it's clear that your retarded comment belongs solely on reddit.
>Thus any anon who uses this phrase is most likely a /pol/ack
This is an absolutely retarded and baseless assumption. The context he used it in is obviously and blatantly related to "The Matrix".
>I rarely see "redpill me" on the smaller boards where newfags don't visit.
Your anecdotes are entirely irrelevant.

>>60155105
Yeah, your """"argument"""" is pretty good as well.
>>
>>60155070
just because he uses the term redpill doesn't mean he's from pol. the fact you get so triggered by it makes it seem like you really care about politics, though. maybe you should go to a political forum instead of here
>>
File: 53538661_p0.jpg (199KB, 1280x1689px) Image search: [Google]
53538661_p0.jpg
199KB, 1280x1689px
>>60155141
>I'm not your friend.
B-but why not, anon-kun?

>>60155155
:3
>>
Guys, stop. He's probably a mentally ill tranny. you're going to make him kill himself.
>>
>>60155141
how is /pol/ a mostly leftist board?
>>
File: angry-loli-waifu.png (345KB, 486x440px) Image search: [Google]
angry-loli-waifu.png
345KB, 486x440px
>>60155164
I-I'm a programmer (male), baka!
>>
>>60154925

Someone explain why ftruncate64 produces EINVAL instead EACCESS when the file in question is opened in read-only mode.
>>
File: 1444249368858.png (237KB, 746x720px) Image search: [Google]
1444249368858.png
237KB, 746x720px
>>60155159
Why would I be your friend? You seem to be a leftist and I don't usually associate with them. Unless I'm somehow wrong of course and you aren't one, in which case it's possible that we might be friends.
>>60155169
By definition. Centre-leftist is still leftist.
>>
>>60154925
I think you'd call that a table of mnemonics rather than 'opcodes'.
>>
File: 1470766161656.jpg (26KB, 400x400px) Image search: [Google]
1470766161656.jpg
26KB, 400x400px
>>60155239
>You seem to be a leftist
But I'm not. I just dislike /pol/ because they're invasive with their "board culture," and their newfags don't lurk and merely pour into the rest of the site. (Just look at fucking /sci/ right now!) I'll admit I shouldn't have gotten my panties in a knot and shitposted about "redpill me" because that's exactly what a lot /pol/acks do, but to deny that this phrase isn't used by a lot by /pol/ users compared to the rest of 4chan is wrong. The reason I bring my anecdote into this is because smaller boards don't attract newfags as much as the big boys do (/g/, /v/, /tv/, etc.); as such, since most newfags mostly came via /pol/, I believe I can assert that this can be used as more evidence that an anon who uses "redpill me" mostly likely uses /pol/ as his main board. I'm going to stop posting about this because I shouldn't have started this off-topic garbage, and I won't perpetuate it any further. Enjoy your night/morning/whatever.
>>
>>60155192
I think the intention is to show that you've provided the wrong file descriptor, EACCESS makes more sense for when you're first getting the file descriptor.
>>
>>60154925
are you from UCA?
>>
>feelio when it's been over half an hour and nobody has redpilled you on CISC vs RISC yet
>>
File: 1487913797498.jpg (141KB, 717x880px) Image search: [Google]
1487913797498.jpg
141KB, 717x880px
>>60154961
>your containment board.

do you even realise how much traffic /pol/ has compared to all of the other boards?

also pic related
>>
>>60155141
>Someone who X doesn't deserve to address me like that.
You haven't been bullied enough. Also stop complaining about leftism on /g/, most everyone here is apolitical or a shitlib, complaining about leftism will only convert the people on the fence to their side.

>>60155336
>I just dislike /pol/ because they're invasive with their "board culture,"
Yeah sorry about that, it's gotten wildly popular, more than anyone there wanted. I would say /pol/ has been dead for years but they still do a lot of cool things, hopefully it's still a stepping stone for moving onto less autistic communities (8ch not included).
>>
>>60155359
https://cs.stanford.edu/people/eroberts/courses/soco/projects/risc/risccisc/
http://www.firmcodes.com/difference-risc-sics-architecture/
Startpage, anon
>>
>>60155365
>how much traffic /pol/ has
>boasting
Please stop, we know you're new, calm down.
>>
File: ran_disgust.png (53KB, 204x288px) Image search: [Google]
ran_disgust.png
53KB, 204x288px
10 posts in and the thread is already shit. Good job /g/.
>>
>>60155416
Dude you're autistic please stop derailing the thread.
>>
>>60155437
This post is complete unrelated nonsense
>>
>>60154925
Currently learning EMACS (again). I keep trying it out and trying to get used to it, I sort-of prefer it over vim.
>>
>>60155493
>I sort-of prefer it over vim.
How so, anon?
>>
>>60155500
Well for first impressions I like that you're always in 'insert mode', and that the chords are used in a lot of other places, namely shells and prompts using readline with the default configuration.
>>
>>60155514
Well shit. I'll have to give it a shot.
>>
>>60155587
I think the main problems with it are going to fall into the configuration problem, which no text editor does right but EMACS certainly doesn't do it right.

Interestingly, readline tools like bash etc. can be configured to use a vi-input mode. I've tried it and it's not that nice to use.
>>
>>60155609
Not him, but elisp configuration is very nice after getting used to it, it's a lot nicer than point-and-click config and weird arbitrary text formats. Since an emacs configuration is just a bunch of scripts, you can do really cool stuff that other edtior's don't let you do
>>
>>60155635
The problem I have with this is:
1. elisp is not a nice language
2. people I've known to use emacs often end up with very slow startup times
3. a lot of the information I find on configuring emacs is outdated

But I'm a total emacs noob. Maybe it's fine after I get used to it.
>>
>>60155609
>>60155635
>>60155654
I might be too lazy for this. I've already learned enough Vim such that I can zoom around files fast enough.
>>
>>60155493
Dig. Fuck Vim. Id rather use cat than vim.
>>
>>60155755
>Dig.
Excuse me, what?
>>
>>60154956
CISC are more powerful
RISC are more energy efficient

Asynchronous electronics will dominate both.
>>
>>60155654
>1. elisp is not a nice language
I definitely agree, it's probably the most cumbersome of all the LISP-like languages, but it's still extremely powerful. Modern emacs has a common lisp compatibility layer, so you can effectively configure emacs with common lisp if you'd prefer.
>2. people I've known to use emacs often end up with very slow startup times
I have this same problem, my emacs takes about ~10 seconds to start (which is still better than some other people's configs, but a lot slower than vim and such). The main way to combat this problem is to run an emacs background server process at startup ("emacs --daemon") and attaching to it with ("emacsclient -c"). This way, emacs effectively starts instantly.
>3. a lot of the information I find on configuring emacs is outdated
Yeah, lots of online tutorials are old and outdated. I've found the best way to learn about emacs is through the built-in help system ("C-h i" and "C-h v" + "C-h f" for learning about identifiers)
>>
>>60155758
Didnt u ever use dig? it's kinda like upvoting, but for people who are over the age of 24. I think some urban kids in the 80's used to say it to each other, to mean the same sort of thing.
>>
File: 1492457943543.jpg (58KB, 500x514px) Image search: [Google]
1492457943543.jpg
58KB, 500x514px
>>60155809
Jesus merciful christ. I don't know what's worse: people using "dig" or "this".
>>
If I have one table with 4 columns (ID, no1, no2, no3), is it worth it to separate them, so the numbers are stored in a separate table each?
Table would be as follows
1 01 01 01
2 01 01 02
3 01 01 03
4 01 01 04
5 01 02 01
.
.
.
39204 99 99 04

The total would be 39204 different entries, so what should I do?
>>
>>60155835
>"this".
>>
>>60155892
any reason why not .csv?
>>
>>60155908
I don't know much about sql, so no idea, I just thought that it would be easier to hold so much data in a database, since there's a chance that the data will have to be changed later and I will have to create a program around it.
>>
https://code.visualstudio.com

What the fuck is this? Do any of you use this?
>>
sorry for being a pathetic ass.

I completed my IT degree and avoided all programming courses as I failed comp 101 twice, am i doomed forever in trying to learn programming? Or do i just need to try different methods. I find programming way too difficult.
>>
>>60155892
If it's just the number not really because you would need a key with each table and they join them. It's slower and not necessary from an normalization standpoint
>>
I want to generate a maze randomly with DFS in C. How would I go about doing so? I'm familiar with the logic of a DFS, but have trouble trying to get it started. My brain keeps saying to make a 2D array but also to make a tree. Any advice?
>>
>>60156087
maybe i'm in the wrong for suggesting this, but some people prefer learning things from the bottom-up, and like to understand things from first principles.

if the conventional CS101 approach didn't work for you, you may want to consider learning a stripped-down assembly language (like the one for CHIP-8) and learn how a basic processor works under the hood. This will set the stage when moving to higher level languages like python or java, and help you understand what's realy happening under the hood.
>>
>>60156087
What are you getting hung up on? Anything specific?

I personally started with http://tedfelix.com/qbasic/ which I'd recommend to anyone who had a hard time with a more modern tutorial/course.
>>
>>60156126
I think you can do it with just a 2D array and writing recursive function(s) to fill it in.
>>
>>60155070
>You're correct that the phrase "redpill me" did not come from /pol/, but /pol/acks used it
Straight from SRS aren't you?
>friend
Fuck off you homo
>>
>>60155892
Until you hit millions of rows, don't bother optimizing. 39204 rows is literally nothing.
>>
>>60156117
Yeah, just the number. Is it a performance issue if I have 1 table with 39k entries, or 4 tables, but the data in one table is a different combination of numbers in the other tables?
>>
>>60156345
Table spec should be logical, and it is then either 'efficient' or it's not really viable in a database. 39k is nothing.
>>
Is there a profiling tool, that lets me observe both Java and C++ applications?
I want to observe the heap memory usage for both of these languages, when working with very big arrays.
>>
I'm out of my depth right now. I need to create a chrome extension that gets messages from Facebook in plain text, so that I can send them to something else in python. How the hell can I do this? Sorry if this isn't a good place to ask but I'm desperate.
>>
>>60156396
What's the motivation for this? Depends on what system you're using but assuming Linux I'd be looking in htop or something at the virtual memory and resident memory usage of the application, but that's not "heap" memory usage specifically.

The actual "heap" usage is going to be very similar overall if you're using the same size types and very large arrays.
>>
>>60156396
valgrind
>>
>>60156076
I do. It's pretty comfy
>>
>>60156336
>>60156375
Alright, thank you for the answers.
I have a slightly related question.
What is the best way to view the data in winforms c#? I was thinking of treeview or something like that, so that you can have 99 nodes, 99 child nodes and each child node will have 4 more nodes. I just have no idea how to read the data from a file correctly, since right now I'm holding all the data in a .txt file.
For reference, here is what the data looks like
>>60155892
>>
>>60156431
I'm doing a bit of comparative analysis between these two languages. I did the speed part, and now I want to do the memory usage part. My plan is to get an average value of memory used when filling different size arrays with a fixed value. I was looking for a tool that would be able to provide this information for both of these languages, so that they could be evaluated as equally as possible. Htop sound like a good tool, but I would also like to this comparison on a Windows operating system.
>>
>>60156223
That's what I was thinking, just make a 2D array, fill it with 0's to represent walls and then use DFS where "searched" verticies become an empty space for paths. I'm not planning on modifying the dimension of the maze anyway.
>>
File: 1457449247408.png (382KB, 512x512px) Image search: [Google]
1457449247408.png
382KB, 512x512px
Can anime be considered a type system?
>>
>>60154956
CISC these days is just RISC under the hood.
>>
>>60155798
If RISC is more energy efficient, then would that mean that a RISC virtual machine would also have lower overhead than a CISC virtual machine?
>>
>>60154925
>What are y'all working on?
Trying to figure out what to work on

>>60154950
>Say something nice about her
D is breddy gud, and so is dlang-chan.
>>
File: ayy_lmao.jpg (59KB, 339x339px) Image search: [Google]
ayy_lmao.jpg
59KB, 339x339px
>>60156884
>D is breddy gud, and so is dlang-chan.
Thanks, anon!
>>
File: 1477868066262.jpg (46KB, 288x358px) Image search: [Google]
1477868066262.jpg
46KB, 288x358px
Should I add numbers to my language? If so, which ones?
>>
>>60156643
Why'd you upload a blank picture?
>>
>>60156960
It's supposed to represent all anime pictures.
>>
>>60156946
4 and 59
>>
>>60156483
Pls help
>>
File: 1456319096539.jpg (341KB, 634x707px) Image search: [Google]
1456319096539.jpg
341KB, 634x707px
>>60157006
I mean what type of numbers.
>>
>>60157016
words and bytes
>>
>>60157016
only primes. if you need a non-prime you'll just have compute them using prime factorization.
>>
>>60157025
I've sort of been using them as chars, but I need better numbers now.
>>60157029
That sounds interesting.
>>
>>60156946
MODS
>>
>>60157046
What do you mean by "better numbers?" What is the main design goal of your language?
>>
>>60157029
why would you want that?
>>
analog computing
>>
>>60157489
keep this behind the ghostfence outlander
>>
File: 1460697024831.png (234KB, 696x720px) Image search: [Google]
1460697024831.png
234KB, 696x720px
Writing a program which will print the sum of all prime fizzbuzz under 5 million.
>>
>>60157814
Thank you for your interest in /dpt/. We have decided to not move forward with your application. Please send us any feedback to help improve our hiring process. We wish you the best of luck in your future endeavors.
>>
>>60154925
Could somebody post the best programming challenges / tasks infographic?
>>
>>60157016
Complex numbers. Tropical numbers.
There's a long list of things I miss native support for.
Open a math book and pick some. I'm sure you will make someone very happy if you manage to give them their numbers.
>>
>>60156499
It's rather misguided to compare the languages in this manner.
But valgrind sounds like what you want.
>>
>>60157924
0-1: Solve P vs NP
2-3: Strong AI
4-5: Machine translator with 99.999% accuracy
6-7: GNU Hurd
8-9: Unbreakable cryptosystem

Dubs: You cannot use a computer or any electronic device to complete this task
Trips: You cannot look to or use any prior research (everything must be original work)
Quads: You must complete the entirety of the task blindfolded
Quints: If you require a program to solve your task, you must write it in Malbolge
>>
odd question maybe.
does anyone know about DOS device drivers (*.sys files)?
like how do you write one, and what exactly is the difference between a .sys file and a .exe or .com file?
>>
File: unroll.webm (144KB, 2000x202px) Image search: [Google]
unroll.webm
144KB, 2000x202px
What are you lads doing on this fine Monday also known as International Workers' Day

I made picrelated
>>
>>60158178
dunno what that commie bullshit is supposed to be
today is may day
>>
>>60158112
That's completely ridiculous, GNU Hurd is provably impossible. Please substitute it for something more reasonable.
>>
File: 1445960648331.jpg (929KB, 1920x1080px) Image search: [Google]
1445960648331.jpg
929KB, 1920x1080px
>>60158112
>Solve P vs NP
Undecidable.
>>
File: 12596214_f1024.jpg (61KB, 1024x768px) Image search: [Google]
12596214_f1024.jpg
61KB, 1024x768px
I'm looking for an elegant way to split this output into a 2D array using python.


name: 'RM750i'
vendor: 'CORSAIR'
product: 'RM750i'
powered: 7128994 (82d. 12h)
uptime: 605794 (7d. 0h)
temp1: 39.0
temp2: 29.2
fan rpm: 0.0
supply volts: 230.0
total watts: 46.0
output0 volts: 12.2
output0 amps: 2.8
output0 watts: 32.0
output1 volts: 5.1
output1 amps: 2.3
output1 watts: 11.5
output2 volts: 3.4
output2 amps: 0.9
output2 watts: 3.0



My plan is to use splitline to create the first dimension then for each line in this array split it on ":" and trim the leading space..
>>
File: YAMETEE.jpg (13KB, 480x480px) Image search: [Google]
YAMETEE.jpg
13KB, 480x480px
>>60158112
>>
>>60158232
Prove it.
>>
agdg pointed out my issue from yesterday and I want to thank all of you for your help.
Now I must learn how to change the very first form that the program runs on startup to the mainmenu.cs
>>
>>60158274
Yes, I have done that. Not sure if I will show it to anyone before my death, though.
>>
>>60158266
that's a dict
put commas and braces
enjoy
>>
>>60158294
>mainForm
>formEnemyFight

Consistency, motherfucker.
>>
>>60156483
>What is the best way to view the data in winforms c#? I was thinking of treeview or something like that
It sounds like you're doing something that would better utilize DataGrid instead of TreeView. What exactly are you trying to do?
>>
why is

'(x . (c . (b . ((a . nil) . (d . nil)))))
(x c b (a) d)


and not

(x c b (a d))
>>
>>60158313
Oh wow.. cool.
Would this require concatenation? then reading it in as dict?
>>
>>60158403
dict[name] would return 'RM750i'

etc
it's also iterable so make it a list for all I care, dicts are great for this type of data
plus it's already a dict
>>
>>60158266
Do you have many entries similar to the one you posted, or is that the entire contents of the text file?
>>
>>60158398
oh because of the nil terminator after "a" pointer
nevermind
>>
i>j?i:j


What did he mean by this?
>>
File: 1438500924406.gif (197KB, 348x490px) Image search: [Google]
1438500924406.gif
197KB, 348x490px
Should I be using De Bruijn indices?
>>
>>60158458
did you just assume xir gender ?
>>
>>60158458
If i is greater than j, the expression evaluates to i's value, otherwise it evaluates to j's value.
>>
>>60158465
if you want
>>
>>60158465
>>>/trash/
>>
Forgive me I'm new to this

This is what I have so far.

from subprocess import getoutput

out = getoutput('corsairmi')


from my understanding out is a string. Can it be converted to a dict or addressed as dict?

>>60158433
Entire contents of the output of a script.
>>
>>60158429
See
>>60158516
>>
>>60158516
oh and out = the string posted
>>60158266
>>
>>60158492
I don't really know. Is there any reason to?
>>60158503
Excuse me, what?
>>
>>60158516
Split on string, then every 2n list index is the key, and 2n+1 index is the value.
>>
>>60158516
is getoutput a homemade function ? then modify it to output:

{ key: value, key2: value2 } etc
>>
>>60158557
Well you don't need to worry about fresh variables or stuff like that
I've seen recommendations to use both that and regular vars for local bindings and larger bindings
>>
What are some decent resources to git gud at databases senpai?
>>
>>60158565
Meant split string on whitespace. I think that's the split() method.
>>
Anyone else actually listen to hymns in the background while programming?

https://www.youtube.com/watch?v=d5p_U8J0iRQ&index=4&list=PLDSMmB33bimx0jCj5cNY889GoH23VaPx6
>>
>>60158567
>>60158565
>>60158540
>>60158516
>>60158266
hey, don't take this the wrong way but you should avoid using the subprocess module whenever you can as it's unsafe and (*teehee*) "un-pythonic" Whats to stop me from overwriting corsairmi with something sensitive?

If you're trying to do this in python, try out a python module to get this information:

https://docs.python.org/3/library/platform.html
https://docs.python.org/3/library/os.html

both of those modules will let you get all the same information without having to make a call to something outside of python
>>
File: anal beads.png (53KB, 577x1117px) Image search: [Google]
anal beads.png
53KB, 577x1117px
>>60158516
Maybe you can reverse engineer this in Python, because it seems to work fine for me:
var muhDictionary = muhOutput.Split('\n').ToDictionary(
k => k.Split(':')[0],
v => v.Split(':')[1].Trim().Trim(new char[] { '\'' }));
>>
>>60158585
Grab sqlite and dive into it.
https://en.wikipedia.org/wiki/Database_normalization
https://en.wikipedia.org/wiki/Join_%28SQL%29
>>
>>60158608
Bach chorales.
>>
>>60158585
>>60158616
after you've got the basic syntax down from sqlite and want to use something beefier grab a copy of Mariadb or Postgres from your package manager.

if you're looking to tie in a programming language to a database get familiar with 'ORM's
>>
>>60158608
I'm listening to reol but my opinion might be immediately discarded.
>>
>>60158608
>>60158626
If you like choir music Eric Whitacre has some really great pieces.

https://www.youtube.com/watch?v=G2ZKKXCuaYc

I'm also a big fan of all of Chopin's nocturnes but those aren't hymnals.

I need to start listening to more classic music while I code I wonder how it would effect my approach. Right now I listen to mostly hard techno and noise while heavily caffeinated--all of my code is angry and loosely typed
>>
>>60158611
Dude i see you all the time here helping people in c#, you are literal god, i want to thank you, even though i'm not that guy

please never stop coming here (or in that discord c# group)
>>
>>60158610
I agree. Especially because corsairmi requires to be run as root.

Plus this did seem a bit dirty all in all. I might as well just go to the source of the data rather than rely on another script.

one issue tho is the data is not easily available.. it's read from /dev/hidraw* and needs to be converted from hex because corsair are dicks and didn't make any Linux drivers.
>>
>>60158608
https://www.youtube.com/watch?v=_gpeRfhrlJs
>>
>>60158663
Damn, son, you're making me blush.

Keep the questions coming, and I'll keep helping, if only to stroke my over-inflated ego.
>>
>>60158678
that is pretty interesting. is that script a binary? any information about the hex? Python is pretty excellent at manipulating values into their respective representations (i.e. hex to ascii) If it's not too much to ask I'd be curious to see how it looks if you try to fetch it raw
>>
>>60154925
Learning ARM, have a ARM exploitation course to attend during Blackhat/Defcon. Thought I'd do some pre-reading...I actually enjoy RISC compared to CISC.

Writing a IPv6 poisoning module that enhances Bettercap in ruby and generally learning advanced uses of C, C++ and Python.
>>
>>60158611
>>60158663
>>60158701
/g/ is super friendly today. I'll take a huge risk and say I don't use C# at all but I'm glad to see folks on here who do helping each other out
>>
>>60158663
>discord c# group
I'm wary of any discord group where I don't explicitly know at least some of the users especially because of the reputation discord has around here and how cancerous imageboard IRC channels are, but it's been a struggle to find someone to talk to about the language. Is it a decent group?
>>
File: englishgayman.jpg (16KB, 300x300px) Image search: [Google]
englishgayman.jpg
16KB, 300x300px
>>60158631
Thanks man, will read your links. But is there a "best practices" book somewhere? DB designs, common problems, solutions, tricks, all that. Like clrs but for databases. I always feel wandering in the dark making my databases, feeling like my naive solutions are not good at all
>>
>>60158714
you should take a look at abusing infrastructure that communicates via MQTT. I only say this because it's tailored to use on embedded hardware. most 'IoT' things that aren't http(s) are going to use MQTT. Most of the uC's out there that use MQTT are on hardware too small to have the resources to run TLS/SSL as well so module => broker is always vulnerable. just a thought of something that would be relevant you could play with :)
>>
>>60158738
I've only been in it for a week or two, so far they were really helpful

you can easily find it online, i don't wanna paste it here because of trolls
>>
>>60158694
Damn son, that was hard. What's the actual name of the hymn?
>>
>>60158753
https://www.nostarch.com/mg_databases.htm
>>
>>60158789
I believe it's called Nigram Clavem. I can't confirm, I'm not a believer, let alone a catholic.
>>
>>601587531
I'm sure there are lots of books out there, I'd refer to the publisher if you're trying to gauge quality (nostarch, o'reilly, wiley, etc)

databases are fickle, complex, nuanced things. their form and factor change on use case. There are general things like 'dont use textual indexes' but you can even get around that to a degree.

take a look at the optimization documents for popular implementations like mariadb, mysql, postgresql. their docs are dry, but they'll tell you exactly how each facet of the database can be fine-tuned.

If you're looking at document oriented storage ("NoSQL") take a look at optimizing for MongoDB, CouchDB, Cassandra, and DynamoDB (postgresql can also be configured for doc oriented storage)
>>
>>60158768
I think I found it, guessing it was the top discord channel result on google.
>>
>>60158703
I've just powered off the machine but here is a resource that you might find interesting.

http://forum.corsair.com/v3/showthread.php?t=120092

I'll be back at some point to figure out the hex conversion once I understand how corsairmi knows which /dev/hid raw file to read
>>
>>60158829
One of 3 staff members is xeronik
>>
>>60158844
Yep, that's the one.
>>
>>60158865
Are you the anon helping people here in these threads or some random dude?
>>
>>60158878
I'm >>60158738, not >>60158701
>>
>>60158755
Most of the stuff I play with is ARM SoC. Interestingly they never tend to use IPv4, seems IPv6 by default with the option to role back. I dropped a couple of CVE's a few days ago for RIOT-OS, may have prevented a pretty bad RCE condition from occurring.

DTLS is a TLS datagram library specifically designed for embedded hardware.

https://github.com/cetic/tinydtls
>>
>>60158796
>>60158826
alright, will do. thanks
>>
>>60158806
>>60158789
>>60158694
It's taken from Agnus Dei. The variations I heard were very light in comparison.
>>
File: Capture.png (60KB, 1913x705px) Image search: [Google]
Capture.png
60KB, 1913x705px
>>60154925
does this make any sense?
>>
>>60158963
C#?
>>
Doing a little header only implementation of an algorithm in C++, i've splitted the algorithm in a few functions but i've got a problem, i only want the algorithm function to be callable, and all other small function to not be, i've tried using static, inline, and anonymous namespaces but those functions are still visible from other files.
>>
>>60158899
I think it makes sense from a routing perspective that they'd go with ipv6 and just given the fact that SoC's would probably be massive enough in quantity they'd exhaust the ipv4 pool pretty fast.

this DTLS is pretty cool I haven't seen this yet. How lightweight does it compile down to? Would I be able to use this on something like an ESP32 or ESP8266?
>>
File: anal beads.png (4KB, 239x99px) Image search: [Google]
anal beads.png
4KB, 239x99px
>>60158963
>
bookingTime.AddMinutes(-30);


This doesn't do what you think it does.

Pic related; notice how the variable retains the same value. AddX() on DateTime returns a value you can assign; it doesn't modify the DateTime.
>>
>>60157814
The only FizzBuzz primes are 3 and 5.
>>
>>60158996
To be fair I'm not sure, I don't look at things in unison. I take components of board and attack them..for instance I fuzz ASN1 implementations using libFuzzer/AFL, reverse engineer/analyse, develop exploit, submit report, attain CVE drop exploit. I have a Arduino Due I use as a prototyping board. But I never really get to look at the development side of the things.
>>
>>60154941
If you mean socioeconomically equal, that exists, and it's called B.

It's pretty good to be honest. Chars, shorts, longs, long longs, floats, doubles, and pointer types are all a waste of time, not to even speak of reference types and compound types. Ints are all a real programmer needs.
>>
File: 245.jpg (80KB, 1333x900px) Image search: [Google]
245.jpg
80KB, 1333x900px
>>60158993
>header only implementation
>ree
>>
File: whatidoingwrong.jpg (24KB, 919x165px) Image search: [Google]
whatidoingwrong.jpg
24KB, 919x165px
Need C++ help please.

Pic related is inside main.cpp and main.h

When creating an instance of Input, I am trying to pass in a reference to an instance of Camera.

The circled line gives me exceptions and access violations when I try to run the code.

I need some guidance
>>
>>60159114
>doing nothing but removing implementation steps
>somehow a negative
Bull
>>
>>60159123
The camera pointer is probably not initialized.
Do
 camera=new Camera;
>>
>>60158993
If they are in the header, of course they're always gonna be visible, no way around that.
>>
>>60159155
yeah you are actually right, i think i'll just give a header only implementation where everything is into 1 big function and an implementation splitted in .h and .cc
>>
>>60159151
I actually love you.

You've fixed the problem I've been having for the past 7 hours.

So I need to use new when I want to use a specific instance of something?
>>
>>60159114
>>60159144
That's nice, but who said it?
>>
>>60159239
read this sentence
>>
>>60159188
I'm not trying to be toxic, but this is really basic knowledge any textbook would teach you in the first 5 chapters.
It would be nice if people would put some work into really learning a programming language before aimlessly running around aimlessly, trying to understand error messages and trial and error'ing their way into madness.
>>
>>60159188
A pointer is just a pointer. The default value for pointers is 0. Meaning it doesn't point to anything. If you try to access it (camera->whatever in your case) you're asking it to act upon the object it's pointing to. If it doesn't point in the right place (I.e. You left it pointing at 0 or just had it point somewhere random) you get access violations.
What
new Object;
Does is allocate memory for an object and return a pointer to the memory. So if you do
pointer =new Object;
You have a new copy of object to work with.

So yeah its creating a new instance of something. And as >>60159271 says learning materials will explain this. 7 hours is definitely too much time to struggle with this. You need some guidance. Be it a book or a teacher.
>>
>>60159188
When you declare a Camera:
Camera c;

You're saying, "I need a camera and the whole thing is stored in this function call." The problem with that, as you've probably discovered, is that when the function ends, the camera is destroyed, and if you try to pass it to any functions, it just gets copied, and any changes to the copy go away when the copy goes away.

On the other hand, when you declare a Camera *, as you're doing here:
Camera *camera;

You're saying, "I need a chain to use to puppeteer a camera, and the whole chain (NOT the camera itself) is stored in this function call."

So it gives you the chain. But the chain doesn't come with a free camera; it's just a chain.

The problem you're running into is that you're pulling on a chain with no camera attached. That's what new is there to fix. In the same way that declaring a plain Camera (without the *) says, "I need a camera right here," calling new says, "I need a camera somewhere where it won't disappear on me, and a chain to it right here." Setting your Camera * to the result of new says, "I want this chain to be that chain; the one with the fresh camera attached to it."
>>
>>60159271
>This is really basic knowledge any textbook would teach you in the first 5 chapters.
I understand that.
I'm not very good at retaining information just by reading. I need to type it and give it all a go by making a real program.
I'm currently learning OpenGL, C++ and GLSL at the same time. It's hard to improve on one of these things without finding difficulty in another.
>inb4 learn C++ first
That's rather boring. The way I learnt Java game dev over the past year was learning the things I needed to continue my program as I needed them. I can't just read a book, do a few exercises and have working knowledge of a language.

>>60159296
This is really helpful, thank you.
>7 hours is definitely too much time to struggle with this
I also learnt about pointers during this time, so I guess it's not as bad
>>
Anyone familiar with Qt here?
How come I cannot use QQmlComponent::Status as a variable, I keep getting
>error: expected identifier before ‘int’

As if the enum hadn't existed but I include QQmlComponent header and I can use everything else in regards to that class, just not this enum.
>>
>>60159347
This is amazing. I've print screened this and the comment above.

This feels so clear and natural now, thank you anon. I don't think it's possible for this to be explained any better
>>
>>60156419

Use Rss for the messages and then use python.
>>
Anyone know about Template Haskell here?

>tl;dr How to generate records with Template Haskell

I have a number of records like this:

data Record = Record { len :: Word32
, buf :: [Word8]
}

instance Serialisable Record where
get = do
l <- getWord32le
b <- replicateM len getWord8
return $ Record { len = l, buf = b }

put r = do
putWord32le $ len r
foldMap putWord8 $ buf r


Each record has a different number of fields (one of them has about 50 fields) and each field has a different type (word or list of words). They all need to be serialisable and deserialisable, hence the class Serialisable which is similar to the class Binary, except I need to use little-endian format. I would like to generate the above code like this:

gen_struct $ Struct "Record"
[ Member "len" Word32
, Member "buf" $ List Word8
]


I've been wrestling with Template Haskell for two days with little progress. I'm using a mixture of quotes and constructors for Exp, Dec, Stmt, etc. which is very ugly and doesn't even compile at the moment. I think there's a much simpler way to do this. Should I build a quasi-quoter? Can I just use quotes? Or should I just use the constructors?
>>
>>60159506
you could also use GHC.Generics for this
you might want to look at Lens' makeLenses

what they do is this

data Record = Record {...}
makeLenses ''Record
>>
>>60159506
Aren't lenses exactly for this kind of thing?
>>
>>60159506
>>60159555
in fact there's literally a tutorial on the wiki
lookup generics
>>
>>60159555
>>60159580
I've never heard of lenses before. Looking into it now. Thanks.

>>60159601
Damn, yeah that pretty much shows exactly how to solve my problem. I was looking in the wrong place.
>>
>>60159626
you could use TH instead if you really wanted, but generics is a better fit
>>
>>60159662
I want to use whatever results in the cleanest code, both the code that generates the records and the code that calls it.

I'm not sure if lenses are what I need because I don't have any nesting in my records. Every field is either a word or an array of words.
>>
Best c/c++ profiler that i can launch from terminal?
>>
>>60159679
Generics would work better and more cleanly
I was just recommending looking at the lens TH library because it does a similar thing but for a different purpose, not recommending using lenses
>>
File: scrolling.webm (1MB, 960x540px) Image search: [Google]
scrolling.webm
1MB, 960x540px
You know how you can scroll like in webm related.
What's easy about webm related is that the sizes for the units to be scrolled are fixed.
I'm tasked with scrolling units which are ncurses windows of varying dimensions
How hard would it be to do that?
>>
>>60159394
No problem. But now that you understand pointers and new, I'd suggest next you read up on destructors and delete; and after that, copy constructors and copy assignment operators. Here's why: that magic space where all the chains lead, where new puts things so they don't go away between function calls, that's called the heap, and the more crowded it gets, the more your program slows down, until it eventually crashes. Allowing this to happen unchecked is called a "memory leak." Destructors and delete exist to address this problem, but they come with their own problem, called "memory corruption," which occurs when pointers are used that are chained up to things on the heap that have already been deleted. Copy constructors and copy assignment operators, then, are for making sure this doesn't happen when you copy objects, but if you don't plan on copying objects, you don't need them.
>>
>>60159689
perf or valgrind
>>
if I have a list of type A with objects B,C,D that all inherit from object A how would I access the methods of the B, C, D objects while calling them from the list<A>?

Using c# right now and I have a method that searches the list for a specified object then it ships that object to another method depending on its type but its being sent as an A type instead of B,C or D
>>
>>60159775
???
>>
>>60159841
nevermind I'm retarded
>>
>>60155365

/b/ is the biggest board on 4chan. It's still a containment board.

Most of the really big boards are.
>>
>>60160020
/pol/ out post them regularly now.
>>
File: 59.82fps.jpg (13KB, 677x43px) Image search: [Google]
59.82fps.jpg
13KB, 677x43px
I'm trying to get the FPS to display as an integer.

If I just have
std::cout << "\rFPS: " << (1/deltaTime);

It displays something like 59.732942

The int should make it 59 or 60. But it doesn't.

What am I doing wrong?
>>
>>60160195
*
>>
>>60160195
nvm
found a terrible but functional fix
>>
>>60159692
One more question, can I use generics to generate the records and their contents like this:

struct "Foo" [ Member "foo" Word32, Member "bar" $ List Word8 ]


or will I need to have the records already defined (by hand or using TH)?
>>
>>60160195
#include <iostream>

template <class Tint, class Tfloat>
inline Tint round (Tfloat x) {
return (Tint) (x < 0.0 ? x - 0.5 : x + 0.5);
}

int main (void) {
for (double x (-3.0); x < 3.0; x += 0.1) {
long n = round<long, double> (x);
std::cout << x << '\t' << n << std::endl;
}
return 0;
}
>>
>>60160195
>>60160253
Im gonna be a pain in the but here but if you want an accurate and integer fps counter, the best practice would be to count the number of buffer swaps in a second and update the UI element once a second.
>>
File: photoshop alpha blend test mult.png (28KB, 1535x1304px) Image search: [Google]
photoshop alpha blend test mult.png
28KB, 1535x1304px
Dear /dpt/,

does anyone know how can I mix 2 RGBA colors together?

Example:
255,000,000 : 064 (Red with 25% alpha)
000,000,255 : 064 (Blue with 25% alpha)
109,000,109 : 112 (Desired result)
>>
File: Capture.png (24KB, 628x377px) Image search: [Google]
Capture.png
24KB, 628x377px
Could anybody explain to me why the condition of picrelated's "if" doesnt do what it's supposed to? i.e. keep only messages with DF=17 and TC=11 ?
>>
just to be sure, in C++ if i have stuff like a * 1 where a is an unsigned long long it's actually better if i write a * 1ull right? the compiler should probably do it anyway but just to be sure
>>
Have any of you worked with JSON in C# before, specifically with google's maps api? For the amount of questions about it on stack overflow, there isn't a whole lot of information about it. Most examples are people just writing strings of non-fucky JSON and deserializing those.
>>
>>60160507
I have work with JSon. What is your problem anon?
>>
>>60160471
Linear interpolation.
a*x + (1-a)*y
>>
>>60160516
So I've got the maps api url, Json.NET, my geocode request via WebRequest, and the response:

            var serializer = new JsonSerializer();
WebRequest geocodeRequest = WebRequest.Create(requestUri);
using (WebResponse googleResponse = geocodeRequest.GetResponse())
{
using (Stream jsonStream = googleResponse.GetResponseStream())
{
serializer.Deserialize<LocationInfo>(jsonStream);
}
}


VS says that Json.NET's Deserialize can't take in a stream as input, but the documentation uses this kind of setup to deserialize JSON from a file. Obviously I have to be doing this wrong, what's the right way to go about it?
>>
x86 real-mode question.
I have disassembled a BIOS image and found that it writes to ROM (I'm guessing shadow ram makes that possible?).
now I want to do the same thing, writing to the same address, but when I try it's suddenly read-only. nothing happens.
wat do?
>>
>>60160724
maybe you have to write to other location(s) first, to unlock some kind of safe guard
>>
I use VS Code
>>
>>60160638
It's not that easy
>>
File: Capture.png (21KB, 937x297px) Image search: [Google]
Capture.png
21KB, 937x297px
>>60160481
Now this truly is fishy business.
An "if (L1 && L2 )" which doesnt want to work the same way twice.

SEND HELP
E
N
D

H
E
L
P
>>
>>60155365
90% /pol/ is fake traffic
wheras like a third of /b/ is fake
go away newfie
>>
Can you write your own malloc? If not then kys
>>
File: clf.png (583KB, 673x682px) Image search: [Google]
clf.png
583KB, 673x682px
suggest something neat I can do with deep learning

preferably something that I can put on my resume
>>
Is there a cleaner way to do this in Haskell:

get = do
a' <- getWord32le
b' <- getWord32le
c' <- getWord32le
return $ Foo { a = a', b = b', c = c' }

?
>>
>>60154925
Post Table 2 faggot.
>>
File: KYS.png (84KB, 434x631px) Image search: [Google]
KYS.png
84KB, 434x631px
>>60161003
>being this millenial
>>
Newbie programmer here. Is learning to use a text editor worth it? Or should I stick with nano while I git gud with programming? If not, then which text editor do you guys recommend me? Learning C btw.
>>
I wanna do a machine learning project over the summer to boost my portfolio - any suggestions? The key seems to be something that I can get a lot of training data for
>>
>>60161053
>shit resolution makes parts of it unreadable
Eh, just went and googled it myself, which I probably should've done in the first place.
>>
>>60161059
you should use emacs with evil.
>>
>>60161079
>I wanna do a machine learning project over the summer
i'm doing that too! except mine's an internship at my university. gl
>>
If my code uses an outside library, does the user need that library to run my executables?

I'm a physicsfag writing a dynamics mulation and it uses a libraries for math and equations of motion.
>>
>>60161091
>shit resolution makes parts of it unreadable
That's the idea dipshit milennicuck
>>
>>60161059
>>60161095
Or you could use vim.

Just wait for the daily "vim vs emacs" thread here and ask in there.
>>
>>60160975
make an OpenCV project that does something, like a puzzle solver or something.
>>
>>60161096
What are you doing? Not gonna steal, just curious.

I saw a video of a guy who threw parsed midi files at his model and got to output some shitty baroque music. I'd like something in that vein but I'm not entirely sure what.
>>
>>60160975
Make an AI that can win minesweeper.
>>
>>60160741
yeah there has to be some write-protect bit somewhere. I'm guessing the northbridge deals with that? no idea where to start looking really.
>>
>>60161104
Both is possible, there are tho methods called "static linking" and "dynamic linking".

Static linking copys the used library functions into your executable, while dynamic linking only contains a reference and you'll need a .dll file (or .so on linux) to run it.
>>
>>60154925
>I couldn't find anything else to use
is it that hard to post an anime image?
>>
>>60160976
do
[a,b,c] <- replicateM 3 getWord32le
>>
>>60161125
That actually does sound neat
>>
>>60161105
A millenial is anyone born after 1980, which you no doubt fit into yourself
>>
>>60155365
/pol/, please. Your board gets the same amount of traffic as fucking /v/. You're a containment board by design.
>>
>>60157289
Data compression.
>>
>>60161185
millennial are people who are stupid and lazy and watch TV and obsess over phones and like their vaccines and lots of sugar in their food.
it's a state of mind - or lack of it.
A way of life.
>>
>>60158458
It's a max function written very small.
>>
I'm designing a database for storing anthropometric data, like the iOS Health app

How would you guys do it?
>>
>>60158516
Yes, it can be converted. You'll need a parser of some kind to do so. You can write your own, which takes work, or just use a JSON library.
>>
>>60160805
It literally is.
>>
>>60161240
>figure out the data you need to store
>divide it into tables and fields logically
>assign primary and foreign keys

done
>>
when i do this now, if i do
low, high, sum = max_subarr(numbers)

and i want to do numbers[low:high], i have to add 1 to the high, because pythons upper limit is exclusive. it's kind of annoying me. if the entire list is negative numbers or it's an empty list, adding 1 to the high bound would result in [0:1] which isn't right in those cases
def max_subarr(A):
max = lb = hb = sum = 0
for i in range(len(A)):
for j in range(i, len(A)):
sum += A[j]
if sum > max:
max = sum
lb = i
hb = j
sum = 0
return (lb, hb, max)
>>
how can a linked list be lockfree if the memory allocator may take a lock?
>>
>>60161348
return (lb, hb+1, max)
and check if list has more than 0 items, and then do the splicing
>>
>>60161261
No, it's not
There aren't even 2 separate alpha values in your example
>>
In swing (Java), I'm trying to make use of the method below to populate random numbers under each grid but every time I try to run it it does not work and the grid does not display the mines or numbers for minesweeper. What should I do?
There are more methods but I'll go over the word count if I posted them all.

public void populate(int num) {
int created = 0;
while (created < num) {
int row = (int) (Math.random() * this.rows);
int col = (int) (Math.random() * this.columns);
if (!minefield[row][col].isMined() && !(row == 0 && col == 0)) {
mineTile(row, col);
created++;
}

}
}
public String toString() {
String s = "";
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
s += minefield[i][j];

}
s += "\n";
}

return s;
}
public String toStringRevealed() {
String s = "";
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
s += minefield[i][j].toStringRevealed();
}
s += "\n";
}

return s;
}

>>
What JVM language should I learn in a week? Scala, Kotlin, Clojure, something else?
>>
>>60161059
vi baby
>>
>>60160260
No, Generics only works by analysing datatypes.

data Foo = Foo { foo :: Word32, bar :: [Word8] } deriving (Generic)

instance Serialisable Foo where
put = gput
get = gget
>>
>>60161413
That's just factors of x and y and whether it's premultiplied or not.
But it's still fundamentally linear interpolation.
>>
>>60161392
>and check if list has more than 0 items,
if the list is all negative then it should also return 0:0 though, because that would be the maximum sub array in that case. it seems inelegant to go through and check if every item is negative. i thought there may've been a better way i was missing
>>
>>60158611
I recognise that filename. Any news on that c# 4chan wrapper?
>>
>>60161479
The RGB isn't even calculated the same way as A
>>
>>60161240
I already did that. Table with data collection date/time, data point value, data point unit, data point label. So as long as I have a controlled vocabulary I can easily enter anything like blood glucose mg/dl levels, weight kg and height cm. I suppose I could've used more tables but decided to keep it simple.

I asked to see what kinda schema you guys would come up with

Using sqlite btw
>>
>>60161515
>>60160655
Try something like
var serializer = new JsonSerializer();
WebRequest geocodeRequest = WebRequest.Create(requestUri);
using (WebResponse googleResponse = geocodeRequest.GetResponse())
{
using (Stream jsonStream = googleResponse.GetResponseStream())
{
var muhJson = JsonConvert.DeserializeObject<LocationInfo>(jsonStream);
}
}
>>
>>60161566
Yes it is.
There's just no color channel (obviously) to modulate, but it's the same equation.
>>
>>60161658
Believe it or not, >>60161515 wasn't me. This JSON thing has been absolutely slaying me, though. I'll give it a shot, thanks, Pajeetslayer.
>>
>>60161695
I responded too quickly. Here's how I would really do it, it's much easier:
using (WebClient wc = new WebClient())
{
var json = wc.DownloadString(requestUri);
var locationInfo = JsonConvert.DeserializeObject<LocationInfo>(json);
}


Do you have a public URL or example of the JSON that I can look at to verify?
>>
>>60158465
data Exp a
= Var a
| Abs (Exp (Maybe a))
| App (Exp a) (Exp a)
>>
>>60160655
using (var stream = resp.GetResponseStream())
{
data = JsonDeserializer.Deserialize<ThreadModel>(stream);
}
>>
>>60159841
You don't. You override a method in A for B, C & D.
>>
>>60161735
this is great until you want an environment
>>
>>60161760
type Env a = a -> Exp a
>>
>>60161722
I've been throwing a "large" public address in Texas at it (building number, street, suite #, city, state, zip) since it's the best one I have besides a similar NY address. JSON is too large for a 4chan comment.

https://pastebin.com/DK9saBNe
>>
>>60161772
exists a. (Exp a, Env a)

?
>>
>>60161692
Then explain this:
0.50,0.50,0.50 : 0.50 (RGB:A color 1)
0.50,0.50,0.50 : 0.50 (RGB:A color 2)
0.42,0.42,0.42 : 0.75 (RGB:A result)


I already figured out how to calculate A on my own but RGB is calculated differently
>>
>>60160971
void *my_malloc(size_t s) {
return malloc(s)
}
>>
Did they solve fizzbuzz already?
>>
>>60161833
How about solving fizzbuzz in constant time?
>>
>>60161896
Why not solve it in negative time?
>>
File: anal beads.png (46KB, 989x683px) Image search: [Google]
anal beads.png
46KB, 989x683px
>>60161789
It Just Werkzâ„¢
>>
>>60160971
just finished that class?
>>
>>60161905
it's a fuggin mastuhpiece
>>
File: some fat cat.jpg (150KB, 1600x1131px) Image search: [Google]
some fat cat.jpg
150KB, 1600x1131px
>>60161809
Management material right here
>>
Client: Baierl Cadillac
Location: Wexford, Pennsylvania
Size: 3,500 Sq. ft. Addition, 10,200 Sq, ft. Renovation</p>


Hey guyse, how do I extract the Location only out of this text?
>>
>>60161957
Which regex should I use, I mean.
Notice that both the amount of spaces and the amount of line breaks everywhere may vary!
>>
>>60161795
Actually your environment isn't necessarily (a -> Exp a), that would be for dependent types where Exp also contains the type grammar. You environment is just a function from a to something.
>>
File: anal beads.png (13KB, 639x259px) Image search: [Google]
anal beads.png
13KB, 639x259px
>>60161957
Without more context...pic related.

But if you wanted a non-brittle solution, you'd need to provide more information. You could split it into lines, grab the lines that start with "Location:" and it's easy to go from there.
>>
>>60162004

The context is that this is text extracted from an HTML source file, e. g. data crawling from a website. They list thousands of building projects. Sadly, no hard style requirements they follow, but they always list the "Client: x", then the "Location: x", then the "Size: x".

I will try to replicate your solution in Python. As for now, my regex is

locationregex = r"Location:(\s*)(.*)(\s*)Size"
>>
>>60162046
Post website
>>
>>60162055

http://www.rsscarch.com/project/carmeuse-north-america-headquarters/

It may seem as if they always stick to one pattern when describing projects, but actually, they mess around with tabs and newlines on some pages.
>>
>>60162004
>not using LinqPad for C# scratchpadding
>>
File: BAM.gif (1MB, 785x757px) Image search: [Google]
BAM.gif
1MB, 785x757px
>>60161957
You BETTER find the correct HTML element to extract from or I'm gunna find you and punch you in the BRAIN
>>
File: anal beads.png (21KB, 917x433px) Image search: [Google]
anal beads.png
21KB, 917x433px
>>60162087
I usually just use the C# REPL built-in to VS.

I don't really care for LINQPad
>>
>>60162120
>Starting up the behemoth that is VS just for a quick scratchpad
>>
>>60162127
I always have VS open.

What are you, gay?
>>
Anyone here got any experience with this book?
>>
>>60161957
If you wanna do it with regex, you can just
Regex.Match(test, "^Location: (.+)$", RegexOptions.Multiline);
>>
Is Python the best programming language?
>>
>>60162164
By the way is that the 2017 version? Is worth upgrading from 2015?
>>
>>60162205
No. Nim is.
>>
>>60162205
there isn't any _best_ programming language. Some languages are better suited for certain situations than others.

you don't wear a tuxedo to do heavy lifting, likewise you don't wear overalls to a ballroom dance.
>>
>>60162205
Is that a variant of Scheme?
>>
>>60162245
>Is that a variant of Scheme?
is that a variant of Lisp?
>>
File: lolno.png (79KB, 528x403px) Image search: [Google]
lolno.png
79KB, 528x403px
>>60162225
>you don't wear overalls to a ballroom dance
>>
>>60162225
But you wear underwear to both of those
>>
>>60162210
>By the way is that the 2017 version?
Yes.
>Is worth upgrading from 2015?
Yes, particularly if you want to use C# 7 features, which can be pretty fucking nice (tuples, some pattern matching, local functions, etc.). More info: https://blogs.msdn.microsoft.com/dotnet/2017/03/09/new-features-in-c-7-0/

There's also other little quality of life things, like more useful exception messages, and more performance profiling goodness.

I have to say that CodeLens is fucking fantastic if you're working on a team, but unfortunately only available in Pro or Enterprise. Some say they get it with Community, but I'm not sure how.
>>
>>60162245
I like what I read. Nice one anon.
>>
>>60162225
>2017
>still wearing clothes
Wow, did they just defrost you? This isn't the Middle Ages anymore, son!
>>
>>60162271
>some pattern matching
Isn't C# "pattern matching" just syntactic sugar for instanceof if-else chains?
>>
r8 the algorithm lads
def max_subarray(A):
sums = {}
starts = {}
if A == []: return (0,0)
sums[0] = A[0]
starts[0] = 0
maxv = A[0]
maxi = 0

for i in range(len(A)-1):
if sums[i] >= 0:
sums[i+1] = sums[i] + A[i+1]
starts[i+1] = starts[i]
else:
sums[i+1] = A[i+1]
starts[i+1] = i+1

if sums[i+1] > maxv:
maxv = sums[i+1]
maxi = i+1

return(starts[maxi], maxi+1)
>>
>>60162298
It is literally pattern matching, however you want to take that.

If I do something like:
switch (obj)
{
case Guid g:
guid = g;
return true;
case string s when Guid.TryParse(s, out Guid g):
guid = g;
return true;
default:
guid = default(Guid);
return false;
}
, that is pattern matching.

Even something as simple as
if (muhDick is Penis p) /* use 'p' */;

is pattern matching.

It may not be using other related concepts, such as discriminated unions, but it is pattern matching.
>>
New thread:
>>60162346
>>60162346
>>60162346
>>
>>60162260
touche
>>60162264
this shook my world, i sat here for 5 minutes staring afterward.
>>60162280
thats alright, as long as i can still go outside and throw rocks at plague victims
>>
my neighbor wrote a bunch of tampermonkey scripts in chromium to scrape a website and create a database because he "didn't feel like opening Sublime Text"

he did it in the same period of time I used to type "import urllib" into the python shell. what's his power level? should I pester him to teach me? people tell me he's an weeb who stays at home watching J/K-dramas all day
>>
>>60162390
his power level is beyond reckoning. given time he will rule over you like a serf there is no stopping it
>>
>>60162428
should I get him to teach me or not? and is he actually smart or just autistic?
>>
>>60162446
all paths lead to your subjugation willing or not. your computer's screaming cpu will be used to render anime subtitles at 4000k for viewing on a 720p screen
>>
>>60162505
but how is he going to subjugate me if he never comes out of his apartment except to buy groceries?
>>
>>60162522
you're considering making him you tutor. the process has already begun.
>>
>>60162558
yeah but he watches dramas and documentaries, not anime. I don't think he's that dangerous
>>
>>60162569
>documentaries

sorry I meant those nipponese game shows and nip TV in general
>>
>>60162592
>he watches live nip TV
this man is beyond anything I've seen before. he is likely tracked by the us government as a nexus of autism. I would proceed with extreme caution, but I strongly suggest studying underneath him to gather more information
Thread posts: 322
Thread images: 45


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