[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/ - Daglig programmeringstråd

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: 324
Thread images: 24

File: 817651150.jpg (355KB, 1623x1080px) Image search: [Google]
817651150.jpg
355KB, 1623x1080px
Gammelt tråd: >>57807030

Hva jobber dere med, /g/?
>>
Scala does not have dependent types.
>>
>>57812984
what does Scala "dependent types" even mean?
>>
>>57812957
benis :--DDDD


I made a 4chan image downloader
>>
>>57812995
Apparently Scalafags think this is dependent typing.
data Foo :: * -> * where
Bar :: Foo Int
Baz :: Foo String

-- doesn't compile, must be dependent types at work
qux :: (Foo a, Foo a)
qux = (Bar, Baz)
>>
what is embedded programming like?
>>
>>57813017
>seksti prosent
>>
>>57813040
assembly, if you're lucky, C
debug both hardware and software


[spoiler]just guessing tho[/spoiler]
>>
File: happy.jpg (75KB, 1280x720px) Image search: [Google]
happy.jpg
75KB, 1280x720px
I wrote you a special message, /dpt/ :3

#include <stdio.h> // To print a special message for my friends in the /dpt/ <3
#define x(z, y) z* y = "M{rejg$s$ehs$l$mo$ji$lx$mi}ywqxmkx$vr2\x0p$"; int i = 0
#define _(__) putchar(*__-4); __++; i = i + 1; i++; --i; i = *j-*j; i = *k- *k;
#define z(y) y = "$er$yo}ylv$rxiwr2Exvxe0kz$s$silr$shmo\xEje"; char* j; char* k
main(){x(char, __);z(char* ___); j=&0[__]; k=&0[___]; while(*j!=0) {_(j)_(k)} }
>>
What are some good C++ books and tutorials for someone already familiar with C?
>>
Er Rust et godt programmeringsspråk?
>>
>>57813108
Ja.
>>
>>57813112
Takk.
>>
>>57813108
*speaks in scandinavian*
nope
>>
>>57812957
De är ett imagebord på engelska. Snälla, döda dig.
>>
>>57813173
norsk > svensk

Kona di har en annen mann.
>>
>>57813226
truly this
swedish isn't even a real language LOL
>>
File: poopy.png (19KB, 910x573px) Image search: [Google]
poopy.png
19KB, 910x573px
It does superchip now!
>>
what is the purpose of Travis? YML?
>>
Attention to all posters in this thread!
Please answer the question in post >>57813099
>>
>>57813244
http://erdani.com/index.php/books/modern-c-design/

>>57813239
So you can put a badge on your github page
>>
File: 1466555501596.jpg (14KB, 500x400px) Image search: [Google]
1466555501596.jpg
14KB, 500x400px
I need to refresh my programming skills. I've went from C++, to web dev, then to C# (for Unity reasons). I want to write dlls like all the cool programmers do. I want to write little exe applications like all the cool people do. I want to script like all the cool programmers do.

It's a fucking shame I never went down these paths properly.
>>
>>57813264
>for Unity reasons
Make your own engine or don't bother making a game.
>>
>>57813282
Already did it in the past. Even though I know the path from start to finish, I rather just use a preexisting one. Not a good investment of my time.
>>
>>57813260
Now some tutorials please
>>
>>57813282
>implying anybody in /dpt/ has the knowledge or ability to write a modern AAA engine
>>
>>57813352
>modern AAA engine
What does this even mean?
>>
>>57813368
Graphics without gameplay or story.
>>
>>57813368
It means he's a dumbass
>>
>>57813379
didn't know an engine handles that.
>>
>>57813338
There are no good C++ tutorials.
>>
>>57813392
Why? What's the closest thing to "good" there is?
>>
>>57813389
There's a lot you don't know.
>>
File: carmack headlock.png (59KB, 531x467px) Image search: [Google]
carmack headlock.png
59KB, 531x467px
>that feel when I'll never have carmack as a mentor

He'll just tell me to never stop reading programming books and articles anyway
>>
>>57813403
Bjarne mumbling about "C with classes"
>>
>>57813368
Like unreal engine or frost bite.
>>
Jeg har drukket for mye vin.
>>
Were there any good programming languages invented by non-whites?
>>
>>57813477
No. I can tell you this as a black guy.
>>
>>57813477
Are Scots white?
>>
>>57813480
CIA nigger detected
>>
>>57813488
Nah
>>
>>57813494
Thats right, motherfucker. We knew what the fuck you have been doing all along. You think we were just sitting there taking that nsa crap like it was nothing? Bitch please.
>>
>>57813500
Then yes, ML was invented at Edinburgh.
>>
>>57812957

>no anime image
you know you can't program without anime u fucking bruntwurst
>>
>>57813282
>>57813368
stop remaking the fucking wheel. You're acting like a CS grad; no shared code.
>>57813392
I can raise a glass to this with my difficulties. Better to start high level lang. then move to C++ as it starts to look familiar.
>>57813477
Does it matter? The only loyalty that matters is to your nation. Working and serving with every color. Equal pay and equal work input by all colors.
>>57813239
I had the same question about Gravitar. Im a skeptic, but some of this shit seems like more hipster garbage from California's Starbucks community.
>>
File: 1407407782876.jpg (157KB, 992x880px) Image search: [Google]
1407407782876.jpg
157KB, 992x880px
>>57813559
>The only loyalty that matters is to your nation
>>
>>57813598
>dude stirner lmoa

Get out. Fucking scum.
>>
File: 1469866879083.png (8KB, 461x343px) Image search: [Google]
1469866879083.png
8KB, 461x343px
>>57813605
You sound butthurt.
>>
I'm a raptor, which programming language would be best for me to learn?
>>
>>57813632

Well, you seem to like moving at high speed and killing people, so I recommend C.
>>
>>57813239
>The one thing I learned in my early days is that, in traditional corporate environments, you can often encounter software project managers that earned their positions with years of manipulation, usurpation and other admirable practices. So, understandably, introduction of a CI is not in their best interest. They don't want transparency. Their whole job sometimes boils down to owning all the information and then strategically feeding specific (slightly adjusted) parts to different channels.
The whole chicken and egg problem is that they are the ones that decide on whether to use CI or not. So, if you ever hear stuff like "That would only slow us down", "This project is too small", "We are doing just fine without it" or "We don't have necessary experience", remember this and just smile (if you're cool-headed enough. I'm unfortunately not :)
Guy sounds kind of butt mad.
>>
Whoops, posted a question in a dead thread.

I want to make something that uses brute-force to find the function that produces a given output from a given input, but I worked out that it would lose efficiency very fast as it tested longer functions, since the longer a function is the more redundant rearrangements of it there are.

What's a computationally inexpensive way to make sure I only test unique functions and none of their aliases?
>>
Can you implement a map in your language in which it is a compile-time type error to try to look up a key that does not exist in the map?
>>
>>57813775
You mean a struct?
>>
>>57813789
No, something more extensible. You can't just add elements to a struct in the same way.
>>
>>57813616

Stirntards are the lowest of the low.
>>
can REST use XML as well as JSON?
>>
>>57813775
Yes.
>>
>>57813775
map f [] = []
map f (x:xs) = f x : map xs
>>
>>57813887
REST describes how you interact with a server.
It doesn't specify what format those interactions should take.
>>
>>57814012
You didn't read his post, did you?
>>
http://www.strawpoll.me/11785985
>>
>>57814041
my map is cooler than that type of map
>>
>>57814106
it isnt tho
>>
>>57814096
Who the fuck cares
>>
>>57814120
the desktop's gonna be windows and it'd be a hassle to set up my environment, but it'd have a bigger screen and the bigger keyboard
>>
>>57814096
A laptop with Linux is really comfy desu.
>>
>>57814096
Laptop on campus / elsewhere
Desktop at home
Laptop on bed
>>
when you do sumLists' 1 [] [], i want this to return [1], but it doesn't, it returns []. why?

sumLists' carry [] []
| carry == 0 = []
| otherwise = currentIndex : sumLists' nextCarry [] []
where
currentIndex = carry `mod` 10
nextCarry = (carry - currentIndex) `div` 10
>>
>>57814292
why not

sumLists 0 [] [] = []
sumLists ...
>>
>>57814292
ok nvm, the repl add on i have in atom was trying to gaslight me. i restarted it and it works now
>>
>>57813081
Most embedded systems have C compilers nowadays. You'd very rarely have to program in ASM.
>>
>>57813081
embedded is C
>>57814384
>>
>>57806806
>C++
Practically poison for the mind.
>>
>>57814767
>b-but at least i have a job!!1!
>>
File: 1352185422124.jpg (60KB, 960x640px) Image search: [Google]
1352185422124.jpg
60KB, 960x640px
>>57814767
wew

That's something.
>>
>>57813352
>modern AAA engine
Anon you simply don't realize what gamedev is like.
AAA studios have special requirements to them. Their pipeline is not made for one game. They have this idea of "we're gonna make this engine, it's gonna be cutting edge and we're gonna have experienced people work on it for a long time and perfect it, it's gonna be an investmet we make for 5-7 games" or so. Same with all the tools they build. You often find that studios develop their own special tools for things like map editing etc. They're all very generic, fits for many games etc.

But indie developers don't have the same things to concern themselves with. They can make their one engine for their one game.

Making a Unity replacement would be a lot of work, and it probably wouldn't serve you well at all.

I'm very confident that given time most people here could write something like it though.

Here's an interview with mike acton, timestamp links to where he addresses this very thing.
https://youtu.be/qWJpI2adCcs?t=2736

It bothers me when people speak on topics they haven't even bothered to research at least a little. I'm sure most of you have written a small game. you should have some perspective on how you could scale it up, it's not particularly hard. It's an incremental process that might take work but it's rarely the case that your problems get much harder.
It may be the case that where you were at some point was problematic and you didn't deal with it so you need major code refractoring which is annoying. But that's just the nature of not being perfectly informed.
>>
>>57814877
If you want good looking modern 3D graphics you'll have a hard time writing your own engine to handle it all. Why do you think so many indie games are pixel shit or have minimilast style 3D graphics.
>>
>>57814952
>If you want good looking modern 3D graphics you'll have a hard time writing your own engine to handle it all.
There's so many resources to help you.
Unity (just as an example) generally does a terrible job. They perform way below what you'd expect of a specialized engine.

It's not as hard as you make it out to be.
>>
>>57814991
I meant more something like unreal or cryengine.
>>
>>57815236
Then the features you're impressed by is 'materials'. Some shaders and a good pipeline for different texture maps.
PBR (physically based rendering) being the big buzzword.

But sure, for that particular niche it's more work to do alone. It's also a lot more artists work so you wouldn't go there for multiple reasons.
>>
>>57812957
Jeg prover å implementere en enkel lenket liste i c++, men c++ er jo helt unodvendig vanskelig.
>>
>>57815284
There's not much C++ madness you can fit into a linked list implementation anon.
>>
>>57815254
I'm familiar with those features but you're kidding yourself if you think that's all those engines provide graphically.
I agree for 2D, isometric, etc but 3D is different.
>>
>>57815320
>you're kidding yourself if you think that's all those engines provide graphically.
I have nowhere said that what you mentioned is all they provide. Good strawman.
PBR is a rendering system. It's standalone.
It's enough to produce a good looking 'realistic' 3D game. Of course every feature you want you will be implementing yourself. So if you want exactly what UE or Cryengine does maybe go with those.
The vast majority don't.
>>
Any good programming podcasts?
Ideally about the practice. But 'programming news' is fine too.
>>
>>57812957
Is having an active blog and github actually helpful for getting hired? also tell me everything I should know about blogging and github
>>
>>57812957
What's a version control system that respects my privacy?
>>
File: Capture3.png (19KB, 871x379px) Image search: [Google]
Capture3.png
19KB, 871x379px
I'm trying to make it in Java so that my labels can change what Icon they are displaying, and it seems like an ActionListener is the best way to do it, but I'm still a little confused.

>ActionListener will trigger and perform the thehandler class (according to the tutorial I found) when an event occurs

How do I declare what the event that triggers ActionListener will be? Also why I am I red lining?

I appreciate the help.
>>
>>57815296
JUST
#include <stddef.h>
#include <stdio.h>

/*
* Generic node for singly linked list
*/
template <class T> class Node {
private:
Node<T> *next;
T data;

public:
void setData(T const&);
T getData();
void setNext(Node<T> const&);
Node<T> getNext();

};

template <class T>
void Node<T>::setData(T const& inData) {
data = inData;
}

template <class T>
T Node<T>::getData() {
return data;
}

template <class T>
void Node<T>::setNext(Node<T> const& n) {
nexr = n;
}

template <class T>
Node<T> Node<T>::getNext() {
return *next;
}

/*
* Generic singly linked list
*/
template <class T> class SinglyLinkedList {
private:
Node<T> *root;

public:
void insert(T data) {

}
};


int main() {
Node<int> n1;
n1.setData(5);
printf("%i\n", n1.getData());

Node<int> n2;
n2.setData(7);

n1.setNext(n2);
printf("%i\n", n1.getNext.getData());

return 0;
}
>>
File: sicp.png (929KB, 873x1079px) Image search: [Google]
sicp.png
929KB, 873x1079px
About to start reading this.
What am I in for?
>>
what's the difference between echo and printf for scripts
>>
>>57815470
Also interested in this.
>>
>>57815571
The more "prestigious" company recruiters do take GitHub and social media into account when hiring.
>>
>>57815621
>red lining
That's your IDE telling you it has detected a problem.
The yellow lining is a warning or other information.
>according to the tutorial I found
I think you've read it wrong.
You can't "trigger a class". Likely you're meant to overload a function (as it looks like you have with actionPerformed) and that function will trigger.
>how do i declare what event triggers actionlistner will be
The event you're given in the function has information about that I believe.
https://docs.oracle.com/javase/7/docs/api/java/awt/event/ActionEvent.html#getActionCommand()
But I've just spent ~20 seconds googling anon.
I don't really know java.
>>
>>57815648
Well printf is formatted. Echo isn't really.
Printf is just a convenience.
>>
>>57815640
>Not even using rvalue references
>Not having a constructor with varidatic templates for checking types
>Not having a constexpr version of this

It's like you WANT to be inefficient.
>>
>>57815571
Blogs are cool, bonus points for having your own domain and email server.
GitHub is a meme
>>
>>57815645
Feelings of inadequacy
>>
reverse1 x = reverse' x []
reverse' (x:xs) ys = reverse' xs (x:ys)
reverse' [] ys = ys

reverse2 [] = []
reverse2 (x:xs) = reverse2 xs ++ x

can someone run these two on [1..1000] and compare the times?
>>
>>57815697
>it's like you want to be inefficient
Well he's writing a linked list so presumably that's the idea.
>>
>>57815621
Click on the red exclamation point, what's the error about? Could be:
>lblNote1 doesn't have an addActionListener method
>needs a try catch block


I think 'trigger' is just a different term for calling the method
>>
>>57815719
But you can be efficient in your inefficiency, which is the true C++ way.
>>
>>57815729
>zero cost abstractions for terrible ideas
Indeed.
>>
>>57815640
in Haskell this is just

data LL t = Null | Node t (LL t)
>>
>>57815775
i hate java. why is it used again
>>
>>57815775
And usage?
>>
I never have any ideas of what to program.
>>
>>57815802
>have an IQ high enough to be decent programmer
>too low to be a good programmer

who else /codemonkey/?
>>
>>57815796
n1 = Node 5 n2
n2 = Node 7 Null

Add deriving (Show) to the declaration, and then you can just do

main = do
print n1
print n2


But lists are already built in anyway
n1 = 5:n2 -- 5 : 7 : []
n2 = [7] -- 7 : []
>>
>>57815802
Do you have trouble finding problems to solve?
>>
>>57815790
it's the only way compsci professors can have kids pass their class.
desu ive been thinking about pushing c# in courses since the skill floor is low and vstudio is a great ide
>>
>>57815824
I feel confident in my skills, yet I don't want to do anything due to lack of confidence in finishing anything worthwhile.
>>
>>57815728
The error is that it doesn't recognize "addActionListener" as a symbol.

You can't just call ActionListener though, ActionListener responds to when an event occurs in an object.

Right now I'm trying to figure out how I can make ActionListener recognize my event so that I can the proceedings in the method actionPerfomed can happen. I need to make it pick up an event in a label.
>>
File: d76.jpg (228KB, 968x648px) Image search: [Google]
d76.jpg
228KB, 968x648px
>>57815802
program an AI waifu
>>
>>57815346
>PBR is a rendering system
No it isn't. At best it's a methodology.
>>
>>57815862
I hope that's milk
>>
File: 1452028422525.webm (3MB, 1280x720px) Image search: [Google]
1452028422525.webm
3MB, 1280x720px
I don't like O'Reilly books, honestly.

You can't use them to study because the author only presents concepts to you (no exercises, practical examples, etc). You can't use them as reference either because when you need something you just google the solution.

Having said that, can someone suggest a book/link to learn scripting? Something with a lot of examples, please.
>>
>>57815871
>milk and pizza
>>
>>57815881
i always new bill liked anime
>>
>>57815875
o'reilly books exist for the sole purpose of maymays. easiest way for me to get a general grasp of a new language is to make general purpose programs in it, like a telnet server, or something that uses async I/O
(assuming you already know one language decently)
>>
>>57815346
PBR is a a beer.
>>
>twf to smart for haskell
>>
>>57815710
Why?
>>
SHOULD I LEARN GOLANG?

Is this shit still relevant in 2016?
>>
>>57815857
I assume lblNote1 is an instance of Button object?
Just guessing from this link, I assume your class should extend WindowListener and ActionListener?
>https://docs.oracle.com/javase/tutorial/uiswing/events/actionlistener.html

I'm just guessing out of my ass, not that much people use awt/swing library nowadays
>>
>>57815930
Golang was never relevant.
It's just a shitty version of C.
>>
>>57815875
Try Manning Publications, may not be the best depending on the subject but they're usually a safe bet
>>
Really simple applications and web shit.

What language should I learn?

GO?
>>
>>57815950
Why? It looks cool
>>
>>57815952
Python.
Keep in mind it's shit.
>>
guys be honest, am i an asshole for trying to push usage of Rust at work?
>>
>>57815964
I really despise running Python code so much.

Anything else?
>>
>>57815967
no
you're an asshole for idolising rust
>>
File: 1459239325633.jpg (136KB, 1280x720px) Image search: [Google]
1459239325633.jpg
136KB, 1280x720px
>>57815890

I want to learn scripting/scripting languages but the thing is I'm a very simple man, so I did everything I needed already.

Bulk rename? Done. 4chan file downloader? Done. Bulk zip and bulk extract? Done.

I can't create problems to solve, that's why I like to follow examples.
>>
>>57815967
Rust is terribly designed, so yes.
>>
>>57815987
It's the firefox of programming languages.
>>
>>57815980
well go make a pet project or something, like a game emulator, or disk drive utilities (like a uefi editor or something)
>>
>>57815719
How is Linked list inefficient?
>>
>>57815967
just tell them pajeets can't replace you with this language
>>
>>57815999
linked lists obliterate cache locality

you should realize that jumping through pointers is much much slower than simply reading flat arrays into L3 cache memory, and you don't even have to do anything because CPUs are really good at precaching.
>>
>>57815974
Ruby, Perl.
>>
>>57815999
Pretty good summary:
https://www.youtube.com/watch?v=YQs6IC-vgmo
>>
This is what happens when Java monkeys want to program in C
fn read_username_from_file() -> Result<String, io::Error> {
let f = File::open("username.txt");

let mut f = match f {
Ok(file) => file,
Err(e) => return Err(e),
};

let mut s = String::new();

match f.read_to_string(&mut s) {
Ok(_) => Ok(s),
Err(e) => Err(e),
}
}
>>
>>57816024
Not him but what are some good resources for ruby? Is why's poignant guide good?
>>
>>57815999
Awful cache locality.
It's not really anything to worry about for smaller lists, but for very large lists, it can be a very large performance penalty.
>>
>>57816031
Ah Rust.
Has there ever been a language with a more vocal community of degenerates?
>>
>>57815857
I was able to finally get the icon of a label to switch, by using a button. In my situation I need Objects with actions. Is there any way you guys can think of where I could use an action that doesn't require the user to press a button for it to change?

Is there a way to have a button be pressed by the code rather than a person?
>>
>>57816060
Haskell
>>
File: 1473176707847.jpg (130KB, 768x1024px) Image search: [Google]
1473176707847.jpg
130KB, 768x1024px
>>57816083
>Haskell
>degenerate
It's the purist language out there
>>
>>57816091
I'm just baiting, nice drawing.
>>
>>57816012
>>57816029
>>57816039
Makes sense
>>
File: coqawaii.png (276KB, 650x600px) Image search: [Google]
coqawaii.png
276KB, 650x600px
>>57816108
I didn't draw it but it is nice
>>
>>57816031
What?
fn read_username_from_file() -> Result<String, io::Error> {
let mut s = String::new();
File::open("username.txt")?.read_to_string(&mut s)?;
Ok(s)
}
>>
>>57816031
I'm not too huge on Rust, but I think it has some interesting ideas.
Anyway, your code is overly verbose:
fn read_username_from_file() -> Result<String, io::Error> {
let mut f = try!(File::open("username.txt"));
let mut s = String::new();

f.read_to_string(&mut s).and(Ok(s))
}
>>
>>57816151
>, but I think it has some interesting ideas.
you mean the ones it borrowed from FP?
>>
>>57816155
Yeah, pretty much.
After learning Haskell, I could see that Rust was heavily inspired by it.

>>57816130
>?
Is that new?
>>
>>57816162
does rust have GADTs or just ADTs?
>>
If I wanted my program to implement a manycam type function where it outputs the display as a webcam what would I use?

Any language is good
>>
>>57816162
Yup, just got pushed to nightly a few weeks ago.
>>
>>57816162
>>57816177
Why don't they just add do notation?
Are they waiting on HKTs?
>>
>>57816062
Separate the logic to its own method.
If your actionevent calls a method, that method should be called by something else as well
>>
>>57815926
it gets hard
>>
>>57816185
Beats me, i'm just happy i don't have to look at try!try!try! anymore.
https://blog.rust-lang.org/2016/11/10/Rust-1.13.html

took them fucking long enough to add println!()
>>
are racket's macro constructs the same as common lisp's?

would one recommend getting well versed in common lisp before moving on to racket?
>>
>>57814012
map f = foldl (\acc x -> f x : acc) []
>>
>>57816185
Honestly you don't even need HKTs for do notation to be useful.

Here's something kind of relevant:
Moving forward, I think a more generalized notation is in order. It's for CPS in general, not just for monads, though it only works well with currying.
do
x <- foo
y <- bar x
baz x y

is sugar for
foo (\x. bar x (\y. baz x y))


Do notation as we know it can be recovered quite easily:
bind : M A => (A => M B) => M B
do
x <- bind foo
y <- bind bar
baz x y


I'm sure it could be extended to arrow-like constructions.
>>
Is C++ a lot more high level than C?
>>
>>57816376
x86 assembly is a high level language according to the tutor my friend was getting help from at University of Hawaii.
>>
>>57816376
Yes and no.
I know that's an extremely unhelpful answer, but you could argue either and you probably wouldn't be wrong.
>>
>>57816376
It can be.
>>
>>57816383
It's high level compared to microcode, which is high level compared to state machine logic, which is high level compared to electrons on a wire, which is high level compared to quantum mechanics.
>>
>>57816383
Low/high level are pretty useless as absolute quantifiers. But saying whether X is higher/lower level than Y? No problem.
>>
>>57816404
Damn, I just realised I could have put transistor logic in there too.
>>
>>57816442
Don't worry about that, this is already a good post.
>>
help me with my bash script /dpt/

I want to get the name of a file (no extension) and use it to create a folder
how do I do that?
>>
>>57816664
Use JQuery.
>>
>>57816664
def get_name():
return ''.join([random.choice('python') for _ in range(10)])
>>
>>57816170
I think only ADTs
>>
>>57816681
lol'd
>>
>>57816170
>>57816688
Rust only supports regular ADTs but you can turn them into GADTs (sans existential quantification) with your own equality type. It's ugly, but it works.
https://gist.github.com/sstewartgallus/5605948
>>
>>57816664
>I want to get the name of a file (no extension)
sed -r 's|^(.*/)?([^.]+).*$|\2|'

I can't be bothered explaining it; it's regex magic.
>use it to create a folder
#!/bin/bash

myfile="/tmp/test.tar.gz"
mkdir $(sed -r 's|^(.*/)?([^.]+).*$|\2|' <<< "$myfile")
>>
>>57816795
That's for very old (pre-1.0) version of Rust, here's an updated Fork: https://gist.github.com/Sgeo/b707a941e2460b25d59b

But yeah, still awkward and ugly.
>>
Norja ei :DDD
>>
>>57816376
In C++ you build your own abstractions.
So yes if you make it so.
>>
>>57816664
http://stackoverflow.com/questions/965053/extract-filename-and-extension-in-bash
>>
File: 156.png (39KB, 567x318px) Image search: [Google]
156.png
39KB, 567x318px
Why is 4chan so popular in Finland?
>>
>>57816894
because finns are stupid and pedophiles who eat potatoes
>>
>>57816820
>
sed -r 's|^(.*/)?([^.]+).*$|\2|'

Isn't
sed -r 's|^(?:.*/)?([^.]+).*$|\1|'

better?
I'm a regex newbie.
>>
>>57817020
That's not valid.
sed uses POSIX regular expressions, not Perl regex or whatever that is.
>>
>>57816206
I love hard
>>
File: bordals.png (1MB, 959x600px) Image search: [Google]
bordals.png
1MB, 959x600px
Got back to working on portals, they're massively efficient now and only render fragments that they have to. VR is still working/seamless, all that I have to do now is share the shadow buffer between the cameras to squeeze that last little bit of efficiency out of these fuckers
Here's a little non-vr demo: https://phygon.itch.io/portal-example
>>
AoC 2016, Day 3, post 'em.

My solutions in Python:
Part 1: https://paste.installgentoo.com/view/raw/a0a6f83c
Part 2: https://paste.installgentoo.com/view/raw/27000eb8
>>
>>57817020
$ ls | sed 's/\..*$//g'

(((this works because sed is very greedy)))
>>
>>57817211
That just removes extensions.
Mine was written to remove directories as well.
i.e "/tmp/test.tar.gz" => "test".
Yours does "/tmp/test.tar.gz" => "/tmp/test"
>>
>>57817171
The fact the camera isn't pointing toward the center of the cube infuriates me.
>>
really can't decide between lisp and haskell
>>
>>57817261
sed -n 's/^.*\/\(.*\)\..*$/\1/p'


:-)
>>
>>57817264
Sorry anon
compiling takes like 20 minutes or I'd fix it
>>
>>57817317
"/tmp/test.tar.gz" => "test.tar"
>>
>>57817340
sed -n 's/^.*\/\([^.]*\)\..*$/\1/p'
>>
>>57817312

Neither. If you must, choose a Lisp. I recommend Clojure.
>>
>>57817360
"test.tar.gz" => no output
>>
>>57817361
which, then.
>>
>>57817312
Learn OCaml. You'll never come back.
>>
File: pkHSU.png (67KB, 989x492px) Image search: [Google]
pkHSU.png
67KB, 989x492px
why did none of you autists figure out an algorithm running with O(nlogn) tops to create 3-dimensional concave hulls out of a point cloud yet?
>>
>>57817378

>which
CLOJURE

It's a Lisp-1. It runs on the JVM, but has ports to .NET and Node (ClojureScript). It has some real world use in concurrency.
>>
>>57817446
but haskell has concurrency
>>
I thought strong typing was a good thing until I encountered JSON
holy fuck haskell json libs are complicated as fuck
>>
>>57817454
>i'm unable to do CSP style concurrency in a dialect of the language that literally invented CSP style concurrency

Why are Haskell users so retarded?
>>
>>57817454

Most languages have the ability to do concurrency. Clojure is just the preferred functional language for the task. Probably because of Java interop capabilities and the fact that S-expression syntax is a hell of a lot nicer than Haskell's god-awful syntax.
>>
>>57817423
Why would anybody have done that
>>
>>57817468
are clojure macros the same as common lisps?
>>
>>57817375
sed 's/^.*[\/]//;s/^\([^.]*\)\..*$/\1/'
>>
>>57817468
do I need to know java before clojure
>>
>>57817484
because 3d scanner and some other things
>>
>>57817489
If you're going to use 2 expressions, now '^\([^.]*\)' becomes unnecessary. You could just do what you were doing before.
sed 's/^.*[\/]//;s/\..*$//g'

I suppose you used two expressions because you realised doing it with one would look exactly the same as mine.
>>
Are singletons a meme?
>>
>>57817512
yeah you're better than me anon
>>
>>57817446
no, I meant, if they're not necessary, then which
>>
>>57817386
>enjoy your GIL
>>
File: okj.gif (329KB, 500x280px) Image search: [Google]
okj.gif
329KB, 500x280px
Anyone else think regular expressions are a hacky solution for lazy people and should be avoided?
>>
>>57817518
>reeeee static
>lets use this dependency injection method with reflection which is highly inefficient
>>
>>57817532
m expr?
>>
>>57817532
Same can be said about scripting languages.
They have their niche
>>
>>57817176
Just did day 1's problem
#include <stdio.h>
#include <stdlib.h>

int main(){
int x = 0, y = 0, diff = 0;
char comp = 0, dir;

while(scanf("%c%d, ",&dir,&diff)!=EOF){
if(dir=='R')
comp = (comp+1)%4;
else
comp = (comp+3)%4;
if(!comp) y += diff;
else if(comp == 1) x += diff;
else if(comp == 2) y -= diff;
else x-=diff;
}
printf("%d\n", abs(x)+abs(y));

return 0;
}
>>
>>57817500
No, but it might increase your knowledge about how the JVM works.
>>
>>57817485

http://stackoverflow.com/questions/9611821/macros-clojure-vs-common-lisp

Not exactly the same, but you can more or less do a lot of the same shit.

>>57817500

No. But knowing Java first will be an advantage, since Clojure basically has all of Java's standard library on top of its own standard library.

>>57817532

Regular expressions have their uses. And sometimes you want a hacky, lazy solution to things.
>>
>>57817526
>GIL
My what?
>>
>>57817532
Every non-assembler programs are hacky and should be avoided.
>>
>>57817593

Global Interpreter Lock. It's a thing a number of languages use to prevent concurrency within a process. Ruby and Python both have it, I'm guessing OCaml has it too.
>>
>>57817579
give your thoughts on racket and common lisp
>>
>>57817621
Look at what Jane Street does.
>>
I have a function that gets a sturct pointer to the first element of a linked list and a struct pointer to a linked list type (min) as parameters.
This function searches for the smallest element, then assigns that to the second pointer:
 min->data = iterator->data 

data is a struct that has a few variables, but it seems that I can only copy a few, the rest gets filled with random data.
min is malloced before this function is called
>>
>>57817176
Day 2:
#include <stdio.h>
#include <stdlib.h>

int main(){
int x = 1, y = 1;
for(char c = getchar();c!=EOF;c=getchar()){
if(c=='\n')
printf("%d", y*3+x+1);
else if(c=='U'&&y>0) y--;
else if(c=='R'&&x<2) x++;
else if(c=='D'&&y<2) y++;
else if(c=='L'&&x>0) x--;
}
printf("%d\n", y*3+x+1);

return 0;
}
>>
>>57817176
>AoC
What did this stand for again?
>>
>>57817740
Advent of Code
>>
>>57817176
Day 3:
#include <stdio.h>
#include <stdlib.h>

int main(){
int x, y, z, sum = 0;
while(scanf("%d %d %d",&x,&y,&z)!=EOF){
sum += x+y>z&&x+z>y&&y+z>x;
}
printf("%d\n", sum);

return 0;
}
>>
>>57817561
>>57817728
I think you've ommited the part two of each day.
>>
>>57817754
Yeah I didn't notice it at first, they append it to the problem page only after you've completed the first part.
>>
> C++

What the shit is cmake and why use it?
>>
does anyone know where to find some functional programming or lambda calculus wallpapers? nothing too flashy
>>
>>57817176

>post 'em
Post a dataset. I can't do these fucking problems without a social media account.

>>57817627

Haven't used Common Lisp enough to form an opinion. Racket's pretty cool. Like a Scheme++.
>>
File: qrewr.png (81KB, 409x406px) Image search: [Google]
qrewr.png
81KB, 409x406px
>Final year programming course
>Doing very well, all my best grades are from pure programming modules
>I actually hate programming
I would prefer to do photography or music mastering but programming is such an easy money.
help
>>
>>57817745
Does it have some completion progress per account?
>>
>>57817870
Task (both parts): https://paste.installgentoo.com/view/raw/8a7a0a47
Input: https://paste.installgentoo.com/view/raw/3607d67e
Answers (so you can verify): https://paste.installgentoo.com/view/raw/d32af4a0
>>
>>57817893
Earn enough monies first from your programming job, quit it, master music, rinse, repeat.
>>
>>57817896
yes, you get a star for each part of each task
if you complete in the first 100 you also get leaderboards score
as you progress the ascii art on the main page gets colorized
>>
Why does everything grind to a halt in Torch if I have Lua tables larger than around 500 entries, if I manually split them up in to normally distributed at size 200 everything just flies, so it makes me think it's something with the Torch implementation of Stochastic Gradient, should I just code my own function or what?
>>
If I free a struct that has a different kind of struct inside it, the second gets freed as well right?
>>
>>57817930
Yes.
>>
>>57817930
yes unless it's a pointer to a struct
>>
I learned very basic HTML and CSS in high-school, and now that I'm NEET, I wanna learn more. Where should I start? Checked CodeAcademy and it seems alright, but are there any other beginner level options?
>>
>"thank you for contacting us about contributing to the project, please answer these 30 questions for us"
what the fuck
questions are weird as shit too
am i being rused?
>>
Does anyone have any idea how f.lux, redshift et al work under the hood?

I have amblyopia and I'm trying to find some software that will put a red/blue filter over my screen for vision therapy. I spend 90% of my day at a computer so this would be a huge help to me. Unfortunately I can't find anything for linux that will do what I want. The closest thing seems to be a windows application called "ss overlay".

I only have rudimentary knowledge of scripting languages and no real programming experience, but I'm willing to give this a shot in the hopes that it can help myself and others fix their vision. I'm asking here to get some advice - how simple of a task is this, will I need to start from scratch or could I just extend redshift, &c.

thanks
>>
>>57817928
I'm not familiar with Torch but since it's open-source you should take a look at their implementation.
>>
>It is not an error to access a non-initialized variable; you just get the special value nil as the result:
who thought this was a good idea
>>
>>57813226
Du har helt ret. Svensk er et klamt og ækelt sprog.
>>
>>57817986
puts a fullscreen window with a filter over every non-fullscreen program
>>
>>57818002
What is wrong with it? You just get nothing back and need to handle it.
Also don't access not initialised variables
>>
>>57817986
I'm guessing they just change your screen settings based on the time of day, or something similar? Unless I'm misunderstanding what they do.
>>
>>57818011
This is what I thought, but if that's the case, then I don't believe it can do what I need it to do, and I'd have to write something from scratch

>>57818009
How would you then interact with the windowed applications underneath it? It would have to be able to pass mouseclicks through or something. Is that possible?
>>
>>57818010
>What is wrong with it?
i cant think of a single situation where i would actually want this behavior over getting error
just halting the program and letting the developer fix the issue would be muc better
>>
>>57817621

Depends on the implementation.
>>
>>57818028
>Is that possible?
It's possible but I doubt that's the case. It's a mess on windows.

My bet is that they interface with the graphics driver in some way.
>>
File: Screenshot_2.png (3KB, 208x290px) Image search: [Google]
Screenshot_2.png
3KB, 208x290px
Made Spess invaders in ncurses and C.

Was fun, apart from getting the timing mechanisms working.
>>
>>57818028
>It would have to be able to pass mouseclicks through or something. Is that possible?
It's definitely possible on windows. Google something called "cthruview", it's written in java so it might even work on linux as well.
>>
>>57818030
just write some magic method that checks if the variable you want to access isn't null and return it or throw an exception if it is if you really can't get around this 'problem'
>>
>>57818038
Gimme the source
>>
>>57818046
This is how Rust was born.
>>
>>57817986
They change the color settings of the display.
https://xcb.freedesktop.org/manual/group__XCB__RandR__API.html#gad2acd72abd9efb04f4770bf97f749367
>>
>>57818046
its not a problem, just a weird design choice is all
>>
>>57817986
>>57818054

Didn't see the mention of Windows, in which case you want to use WinAPI instead of xcb.

https://msdn.microsoft.com/en-us/library/windows/desktop/dd372194(v=vs.85).aspx
>>
>>57817987

Aaah, alright, so the Torch implementation basically goes through every single index in the data every training 'step', that's why it's so slow, sorry I don't know, is it supposed to do that?
>>
>>57817772
bump
>>
>>57818002
>>57818030
>>57818069
I suppose you're talking about Lua, because you said 'nil'.
I think it's just a consistency thing. Whenever you access a (non-local) variable, you're really just accessing the global table (_G). With other tables, when you try to access a non-existent member, you get nil, so it's the same for the global one.
>>
>>57818114
Cmake is cross-platform.
>>
>>57818038
see >>57818051
>>
>>57818051
>>57818124
Eh, sure.
It uses the ncurses wrapper someone asked me to post yesterday.

Source: http://pastebin.com/1BdVyHqE
Curses wrapper: http://pastebin.com/cPZYFhUi
>>
>>57818174
Nice. Could you post the snek game too?
>>
Anyone know a good resource for learning data structures and algorithms? Preferably something that takes a more practical approach
>>
Is anyone here using spacemacs?
>>
File: blythe_,masters.jpg (85KB, 959x639px) Image search: [Google]
blythe_,masters.jpg
85KB, 959x639px
How do I go from Data Analyst to Data Engineer?
>>
>>57818335
It may be a surprise for you, but
"Structure and Interpretation of Computer Programs"
>>
>>57818343
I do
>>
Best C++ book?
>>
>>57818355
Is it worth learning it? Or should I go straight to emacs?
>>
>>57818370
you'd be better off learning java and c#
>>
>>57818394
No thanks
>>
>>57818228
Here ya go.

http://pastebin.com/EBfJS9hr
>>
https://docs.oracle.com/javase/7/docs/api/java/lang/System.html#in

How does System class in java have an object of abstract type InputStream named "in".??
>>
>>57818403
c++ is huge and much less productive than either of those

it's stupid to waste your time on it
>>
>>57818370
K&R.
>>
>>57818414
>in
Is that a keyword in java?
>>
>>57818370
https://www.rust-lang.org/zh-CN/documentation.html
>>
>>57818370
Just read bjarne's book
>>
>>57818228
>>57818407
Oops, just pretend that everything with System_* is just CW_*.
>>
>>57818417
>>57818429
>>57818424
upvoted
>>
File: björne.jpg (42KB, 401x401px) Image search: [Google]
björne.jpg
42KB, 401x401px
>>57818431
This.
>>
>>57818431
What's up with his name anyway? Did his parents mistake "a" for "o"?
>>
>>57818428
Look at that page.
>static InputStream in
The "standard" input stream.
>>
>>57818370
C++ Primer along with Bjarne's C++.
>>
>>57812957
funderar på att flytta till norge
finns det mycket programmeringsjobb?
>>
>>57818431
>>57818489
Isn't Bjarne's book too long winded and retarded?
>>
>>57818519
Du får skala bananer och rensa fisk ditt as.
>>
>>57818376
It's intended to be used by lazy Vim users, who don't want take hardships of learning Emacs.
If you know neither Emacs, nor Vim, decide what you want - if you want to learn Vim, learn Vim, if you want to learn Emacs, learn Emacs.
>>
>>57818547
tragiskt, för jag skulle säkert tjäna mer än vad jag gör som ingenjör hemma ändå så
>>
>>57818588
Antagligen
>>
Nowy thread:

>>57812957
>>57812957
>>57812957
>>
>>57814041
Haskell niggers never read your posts
They will pounce upon any opportunity to show off their trivial puzzle-oriented programming skills
>>
>>57818624
wrong point nigger

new thread: >>57818617
new thread: >>57818617
new thread: >>57818617
new thread: >>57818617
>>
>>57818662
>>57818624
you both suck
>>
>>57818662
Co ty kurwa pierdolona bliat robisz?
>>
NEW THREAD:

>>57818692
>>57818692
>>57818692
>>
>>57818699
> OP-post written in American language
What the fuck, man?
>>
>>57818706
Polish thread got deleted
>>
>>57818716
Why haven't you create a new one, then?
>>
>>57818728
Next time, dobrze?
>>
>>57818734
Take your time, spoko.
>>
How do I set the stack reserve size when compiling with g++?
>>
>>57818833
Just use nasm, it's better.
>>
>>57818833
You should not do that except for embedded.
>>
File: nice.png (332KB, 1920x1056px) Image search: [Google]
nice.png
332KB, 1920x1056px
tryin to get nrf24l01 modules working with pure C to save space and power consumption, compared to a arduino
Thread posts: 324
Thread images: 24


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