[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y / ] [Home]
4chanarchives logo

/dpt/ - Daily Programming Thread


Thread replies: 374
Thread images: 35

File: mastercode.gif (1MB, 1280x1024px) Image search: [Google] [Yandex] [Bing]
mastercode.gif
1MB, 1280x1024px
[Daily Programming] Thread

What are you working on, anonymous ?
>>
>>51251359
1st for Go
>>
SQLite access with Haskell, should be pretty easy.
>>
Rewriting the linux kernel in haskell.
>>
Rewriting the linux kernel in Go
>>
Rewriting the linux kernel in Rust
>>
Nothing its my day off and I'm hungover as shit.

Although I have started to look into F# and its neat.
>>
>>51251406
Rewriting the linux kernel in C#
>>
>>51251428
Godspeed based anon
>>
Rewriting the linux kernel in Delphi
>>
>What are you working on, anonymous ?
Adding some syscalls to the kernel.
>>
>>51251390
how are you gonna use your database without sideeffects anon?
>>
File: s.png (831KB, 679x674px) Image search: [Google] [Yandex] [Bing]
s.png
831KB, 679x674px
I'm learning R, Python, and SQL so I can get a job fapping to all your precious data.
>>
File: shitposter.webm (3MB, 1280x720px) Image search: [Google] [Yandex] [Bing]
shitposter.webm
3MB, 1280x720px
Ask your beloved programming literate anything.

>>51251100
What do you expect from a mentor ?
>>
Correcting the 30th shitty bin tree implementation in C by java babbies.
>>
File: DSC03916.jpg (125KB, 1211x1210px) Image search: [Google] [Yandex] [Bing]
DSC03916.jpg
125KB, 1211x1210px
>>51251359
I'm actually writing a kernel.

Adding multiprocess support right now, using shitty round-robin scheduling.
>>
Last thread, someone had a question about mingw-w64 and Ada. I have a response for them if they are still around.

>>51250336

I have mingw-w64 installed on my computer, and with it, GNAT 5.1.0. It supports Ada 2012 with the -gnat2012 option (actually, this is the default). Searching through the adalib and adainclude directories, I could not find anything related to "Ada Core". Indeed, the substring "core" did not appear in any of the .ali, .adb, or .ads filenames. It is therefore safe to assume that with mingw-w64, applications have the GCC linking exception applied to them, and one can make non-GPL applications with it.
>>
>>51251459
are you a TA or something?
>>
File: 1441488596897.jpg (49KB, 613x574px) Image search: [Google] [Yandex] [Bing]
1441488596897.jpg
49KB, 613x574px
Can someone write me a program that can teach me and my friends how to hit the quan?
>>
File: 1377120235127.jpg (1MB, 1280x800px) Image search: [Google] [Yandex] [Bing]
1377120235127.jpg
1MB, 1280x800px
I fucking love java.
>>
I want to implement a node structure in python, so what i want to do is make an array of "child nodes" but i dont know how to do so, because normally if you want to make an array you just write a = [] but i neet to insert an entire object so i can point to it
>>
Rewriting the linux kernel in Smalltalk
>>
>>51251502
wait 'til you learn a lisp
>>
so, I have this small project (webapp) to which I want to add features... and now, after writing (and again) a few files, I feel it's a burden instead of something I want to do.
FML.
>>
>>51251498
Quan?

>>51251502
I don't. But then again, I like my programs to either run really fast (C, C++), or to be able to be written really fast (Ruby). I am less interested in compromising on both.
>>
>>51251452
I'll keep my side effects neatly tucked inside a monad.
>>
>>51251502
meanwhile, in reality:
http://foxglovesecurity.com/2015/11/06/what-do-weblogic-websphere-jboss-jenkins-opennms-and-your-application-have-in-common-this-vulnerability/
>>
Rewriting the linux kernel in Emacs Lisp so that I never have to leave Emacs again.
>>
>>51251550
It's there a lisp with C syntax?

I just don't like how lisp look (parenthesis).
>>
>>51251552
You should switch to an inherently enjoyable language so that the mere act of writing code becomes a worthwhile experience. I suggest Haskell, but OCaml is good too.
>>
I have a class templated on <typename ... T>
should my constructors take
std::tuple<T&&...>&&
std::tuple<T...>&&

or both
>>
VIM OR EMACS
>>
>>51251576
Someone should at least rewrite the C parts of emacs that handle all the sys calls in an embedded Lisp implementation like GCL
>>
http://pastebin.com/a1Zs5KrK trying to figure out why this is crashing or not working at the specific parts mentioned.
>>
>>51251609
it's not really the language, is the lack of knowledge, experience and motivation that kills me.
I still need to build a DB and an API, and I don't want to fuck up... the site itself was the easy part, apparently

>>51251628
Vim >>>> emacs
>>
>>51251600
>I just don't like how lisp look (parenthesis).
What are you a fashion designer?
>>
>>51251428
Rewriting the Linux kernel in F#
>>
>>51251600
Standard ML
>>
>>51251502
Hey man, I'm a masochist too, but don't you think that's a little too far?
>>
>>51251600
microemacs, its what Torvalds uses
>>
>>51251628
spacemacs
>>
>>51251600

It wouldn't be Lisp then. The key defining feature of Lisp is homoiconicity. That is, that data can be code and vice versa. The syntax behind lisp and scheme is extremely simple, to the point that you could probably fit everything you need to know on a couple of notecards. Everything else is just knowing the standard library.

Also, most text editors provide parenthesis matching features. Who cares if you have )))))))))) if you know what each parenthesis matches to simply by having your cursor next to it?
>>
Working on my bachelor's thesis. It's a 2D visualization of a path-finding algorithm. The platform is WPF and MonoGame.
It'll have built-in map/vehicle editor so I'm currently coding serialization.

Am I the only one who thinks that C# attributes make the code barely readable?
>>
hey guys i wanted to start developing, but I have no idea where to start. I'm learning java right now, and i wanted to make a bot for this discord server im in. problem is i have no idea how to work with the API, and i don't know where to look
>>
>>51251685
because it looks like garbage.
I rather keep using java than to use something I like because it's magical or some BS.

I learned to code to make games, not to masturbate to CS topics.
>>
>>51251622
T2&&...
>>
>>51251712
>java for games
That's almost as retarded as using FP for games.
>>
>>51251692
>path-finding algorithm
which one?
>>
>>51251692
>Working on my bachelor's thesis. It's a 2D visualization of a path-finding algorithm.

... What? That's trivial, Freshman-tier
>>
>>51251725
desu i might give up on move and add it in some other time
>>
File: lol1.jpg (60KB, 380x500px) Image search: [Google] [Yandex] [Bing]
lol1.jpg
60KB, 380x500px
>>51251712
>>
File: 1443738621478.jpg (353KB, 1000x1000px) Image search: [Google] [Yandex] [Bing]
1443738621478.jpg
353KB, 1000x1000px
>>51251692
>bachelor's thesis
>2D visualization of a path-finding algorithm
what... how does that qualify as a bachelor's thesis?
>>
File: UR1AWlY.jpg (10KB, 441x408px) Image search: [Google] [Yandex] [Bing]
UR1AWlY.jpg
10KB, 441x408px
>>51251600
>It's there a lisp with C syntax?
>I just don't like how lisp look (parenthesis).

>>51251712
>because it looks like garbage.
>I rather keep using java than to use something I like because it's magical or some BS.
>I learned to code to make games, not to masturbate to CS topics.
>>
>>51251694
you start with the greeks


seriously now, docs are here: https://docs.oracle.com/javase/7/docs/api/ (java 7)
>>
>>51251692
Literally one (1) hour in python + pyQt.
>>
>>51251502
What is that the shit mantra?
>>
>>51251811
Do it then, fggt
>>
>>51251824
>mfw he does it
>>
>>51251782
oh i meant i dont know how to work with the discord API unless these are the same thing
>>
>>51251824
which algorithm faggit?
>>
>>51251735
Nothing specific. We (me and two collagues) have to come up with something. The vehicle is a polygon that can only move forward and rotate in place. Maps are composed of other polygons.

>>51251740
>>51251773
>>51251811
The space is linear, not a grid so I wouldn't say it's freshman level. We also have to provide polygon editor by point & click and bitmap tracing.
>>
>>51251853
>inb4 A*
>>
>>51251847
nm, I misread, I have no idea what you are talking about
>>
File: why.png (214KB, 500x375px) Image search: [Google] [Yandex] [Bing]
why.png
214KB, 500x375px
Hi guys,

Basically I need to make a rather simple Android app with a register and login forms, picture uploading and payment information. I have ~3 days to develop something what looks like an app. I have no experience with Android and I'm downloading the Android SDK and JDK as we speak. How fucked am I?
>>
okay nerds, how do I code a shmup enemy bullet?
how do I code that it should move in a curve, not just a straight line.

remember that I barely remember anything past elementary school arithmetic.

pls no bully.
>>
>>51251879
unless you use libgdx, you're pretty much fucked.
>>
>>51251886
https://en.wikipedia.org/wiki/Trigonometric_functions
>>
>>51251879
To make it funnier: I use a fucking mac.
>>
>>51251886
take a class on math
>>
>>51251667
That's an editor, not a language.

you dipshit.
>>
>>51251907
Just believe in yourself and you'll be fine. :^)
>>
>>51251502
>Not living by the C mantra
- Trust the programmer.
- Don’t prevent the programmer from doing what needs to be done.
- Keep the language small and simple.
- Provide only one way to do an operation.
- Make it fast, even if it is not guaranteed to be portable.
- Maintain conceptual simplicity
>>
>>51251915
>asks retarded question like is there lisp without lisp's syntax
>gets retarded answer
You really should kill yourself
>>
>>51251899
>>51251918
Thanks guys :)
>>
>>51251948
((((( ( (
slowly
)))))))()
>>
>>51251879
android studio
>>
>>51251773
This. It's barely highschool level.
>>
File: how.png (48KB, 720x618px) Image search: [Google] [Yandex] [Bing]
how.png
48KB, 720x618px
wtf is this and how it works?
pls sponfeed a retard pls.
;u;
>>
>>51251600
OpenDylan is pretty much that.
>>
Anyone know any matlab? I have some colored squares on a white background and I'm trying to get a script that will read the image and give me the area of the square on the image. I remember reading on here once that matlab is pretty good for image manipulation and reading. Anything would be helpful.
>>
>>51252023
>:=
>>
>>51252023
l2trigonometry
>>
>>51252023
https://en.wikipedia.org/wiki/Sine
https://en.wikipedia.org/wiki/Unit_circle
>>
>>51251811
This. I did A* visualization with java and swing and it took less than half an hour, and I had never used swing before nor implemented A*.
>>
>>51251886
fucking fuck the fuck off you stupid fucker
>>
>>51252023
read a chapter on highschool trigonometry lmao
>>
File: 1425532265051.webm (208KB, 507x953px) Image search: [Google] [Yandex] [Bing]
1425532265051.webm
208KB, 507x953px
>>51252023
>>
>>51252023
haha I learned this in like precalculus literally every 14 year old in the US knows this come on son
>>
>>51251940
>Provide only one way to do an operation

Are you sure this is C?
>>
>>51252098
>ameridumbs
>knowing math
>>
>>51252023
lemme guess: you want to make games
>>
>>51251861
I did LITERALLY that (not the point and click editor, I just had to put vertices in a text file) in my second intro CS class.
>>
>>51252112
He's the shmup guy from before, noob. Lrn2samefag detection.
>>
>>51252098
>implying I remember anything from high school
>>
>>51252023
>>51252153

x = cx + r.cos(t)
y = cy + r.sin(t)
∀ t ∈ [-π, π]
>>
>>51252109
What duplicate functions (considering only standard library and the language itself) does C have?
The only thing I can think of is /% and div().
>>
>>51251861
I sure as hell hope you get F- for this garbage.
>>
>>51252161
ffs
[-π, π)
>>
>>51252161
Oh, I wasn't the original poster, just stating that all 4 years of high school have been wiped from my mind
>>
>>51252139
>>51252164
Wow, you're so amazing. Also, wait more than one minute between consecutive posts if you want to look like two different posters.
>>
>>51252186
are you one of those people who always says that I shouldn't go to college because you can learn everything on your own in a library? I would put money on it
>>
>>51252163
*(a + i) is a[i]

x->y is (*x).y

There are a million different functions to print, copy, take input, etc. and most of them are huge security vulnerabilities.
>>
>>51252229
Naw
I just forgot everything
>>
>>51252245
relearn it, maths is cool
>>
>>51252140
m8, do you know how hard is to never put attention in high school about STEM shit because you were too busy trying to learn to do art?

I barely remember elementary school arithmetic.

you know how easy is to watch youtube lectures aimed at kids about high school math when you're like 27?
>>
>>51251502
/g/ likes to shit all over Java, but in terms of actually getting shit done, it's really hard to beat. Sure, there are other languages with very interesting ideas, but I really don't care if some language feature can turn 4 lines of code into one if I still have to write another 100,000 lines because of the lack of quality APIs and tooling. The reason businesses choose Java isn't because they are morons who aren't aware of Lisp or Haskell. It's because they know that it's far better to put up with some minor annoyances than to have to recreate the entire damn universe because those "better" languages don't have the required libraries and tooling.

I also find Java to be more predictable than other languages. Once you know Java, you will rarely find things that outright surprise you. Yes, there are some ugly parts to the language and some inconsistencies, but I find far fewer of those working with Java than other languages.

I'm working on a project now using Java with Spring Batch. I've made a huge amount of progress in a very short period of time. This project will take me a couple months where as it would probably take a full year to get it done with a /g/ approved language because I'd be dicking around with shit that Spring already handles for me. I want to focus on my pure business logic. Java is just better at that.
>>
>>51252055
>lying on an anonymous hungarian cooking site
>>
>>51252278
>/g/ likes to shit all over Java
dropped
>>
>>51252203
Wrong. I only have to say you're retarded once because you are retarded, and anyone can see that.

Please do a real thesis like making a DHT, OS, compiler, or SVM visualizer
>>
File: 1446754709042.png (160KB, 318x365px) Image search: [Google] [Yandex] [Bing]
1446754709042.png
160KB, 318x365px
I have an exercise for you /dpt/.

Say you have base N numeral system. One can put all words in the canonical order like this:
//for N = 3:
e // epsilon a.k.a. empty word
0
1
2
00
01
02
10
..
22
000
001
...
0000
...

Word 'e' has index 1, Word '0' has index 2, '1' has index 3, etc.

You are given N and a word index. How do you generate the word?

>inb4 homework
>>
>>51252278
>The reason businesses choose Java isn't because they are morons who aren't aware of Lisp or Haskell. It's because they know that it's far better to put up with some minor annoyances than to have to recreate the entire damn universe because those "better" languages don't have the required libraries and tooling.
:^)
>>
>>51252278
nice bait you fucking idiot
>>
>>51252303
can you just take a picture of the homework question I can't visualize what you want to do
>>
>>51252303
There is literally NO WAY this is a serious question.
>>
>>51252303

N + 1
>>
>>51252303
This is literally just converting an integer to a string in a particular base.
>>
>>51252295
You sure do seem frustrated for whatever reason. Go take a chill pill.
>>
>>51252278
>because those "better" languages don't have the required libraries and tooling.
GUI builders.
C# is better :^)
>>
>>51252232
>There are a million different functions to print, copy, take input, etc
They all do things in different ways and have different semantics, making them not equivalent. Also C tried to preserve existing practice before it was standardised, making them have to include some questionable stuff like gets() (which they obsoleted and removed later).
>>
>>51252369
Nope. It easy to do the other way around (generate the index having given the word and base) but it's hard to find the smart way to do this.
>>
>>51252397
base<N>(i - 2)
>>
>>51251504
nvm, i did it like this:
class Node(object):

def __init__(self, data=None):
self.data = data
self.next_nodes = []

def get_data(self):
return self.data

def get_node(self, index):
return self.next_nodes[index]

def set_node(self, child):
self.next_nodes.append(child)

def get_length(self):
return len(self.next_nodes)

d = Node(5)
dd = Node(7)
d.set_node(dd)

for x in range(0, d.get_length()):
print d.get_node(x).get_data()
>>
File: 03.jpg (664KB, 1280x800px) Image search: [Google] [Yandex] [Bing]
03.jpg
664KB, 1280x800px
>>51252397
>>
Is it possible to add lexical scope to elisp so it has both lexical and dynamic scope like common lisp?
>>
>>51252397
>if i tell him it's super difficult, he will solve it for me to prove me wrong :^)
>>
>>51252397
If you post the homework problem I will give you the answer.
>>
>>51252319
>>51252305
I suspect you've never built anything apart from simple FizzBuzz type programs. Sure, you can point out examples in the trivial cases where a language like Python is a lot less verbose than Java. I'd use Python or Bash scripts for simple jobs like that. But once you start scaling out into really complicated software, Java is just better.

>>51252376
No, not GUI builders. Most of the software I write doesn't have a GUI. Go look at Spring. On a related topic, that's one of my annoyances with Java EE. They always announce "new" features that Spring has had for years.
>>
>>51252442
 ;; -*- lexical-binding: t; -*-
at the top of every file. Using defvar and such is still dynamic as far as I know.
>>
>>51252303
solution in python
def get_word(N, i):
res = ""
while i > 1:
res = str((i+1) % N) + res
i = (i + 1) / N
return res or 'e'
>>
>>51252421
N = 4
i = 8
the correct answer should be '02'

i - 2 = 6
'6' base 10 is '12' base 4

Bravo.
>>
File: qa2ow.jpg (85KB, 500x666px) Image search: [Google] [Yandex] [Bing]
qa2ow.jpg
85KB, 500x666px
I made this bash script to play all the webm's that we find in a 4chan thread


#!/bin/bash

curl $1 2>&1 | grep -o -E 'href="([^"#]+)"' | cut -d'"' -f2|uniq|grep webm |
{
while read p;
do mpv https:$p || break;
done
}



uses mpv
>>
>>51252488
The problem with your argument is that when Java was in its ascendancy it was not more feature-rich than other languages. Today it has a massive standard library but this was simply not always the case and anyone who isn't 15 knows this, and they therefore know that your entire argument is shit.

Java is popular because the average programmer is shit and companies who want to hire the average programmer don't want to use C or C++ where the average programmer will fuck up their entire world.

There is no reality in which a company almost used lisp but then at the last moment moved to java. The kind of companies that consider lisp would never consider java, though this isn't because java is a bad language.
>>
>>51252488
Like it or not GUIs are a big part of computers, not having a builder makes programming a pain in the ass when you're not doing simple tasks. They might not be the main part of the program (just an interface for it), but they're important nonetheless.
>>
>>51252545
>There is no reality in which a company almost used lisp but then at the last moment moved to java. The kind of companies that consider lisp would never consider java, though this isn't because java is a bad language.
There are a lot of companies who tried Scala and went back to Java, making an enterprise level OO/FP language was a failed experiment with Scala and so far no one has done anything better than Scala
>>
File: 1441100423026.jpg (85KB, 640x640px) Image search: [Google] [Yandex] [Bing]
1441100423026.jpg
85KB, 640x640px
>>51252303
this is day 1 stuff kiddo your teacher just wants you to think in terms of "words" and shit. you literally just write a one liner that takes the "index" or whatever that means, store it in an integer and mod it by N -> store it, will be last element in word, then divide the index integer by N -> store it, attach last element to this word and you are done.
>>
>>51252550
It wasn't a matter of me "liking it or not". It's just that 90% of the work I do is backend server jobs and the other 10% that actually does have a UI will be a web based application.
>>
>>51252620
the use of the groovy language (basically a lot of syntactic sugar for java) has been pretty successful for java webapps in the grails framework
>>
>>51252524
N = 4
i = 8
the correct answer should be '02'

res = (9%4) + res = '1' (i = 2)
res = 3%4 + res = '3'+'1' = '31' (i = 0)

result '31'
wrong
>>
>>51252620
>assume scala is somehow better than java as a counterexample
>conclude that scala is worse than java
How young are you, really? 4chan is 18+. It may seem like the quality of posts here are low but it seems you are completely overwhelmed by your own incompetence because you've mistaken the usual shitposting for a room full of idiots like yourself.
>>
>>51252488
>FizzBuzz
try harder you stupid retard
>>
>>51251940
delusions.png
>>
>>51252303
Silly way to do it in a text editor:
- generate the word list up to N^(log(word_index)+1)
- goto line word_index

dunno if you can easily change ctrl+a's base, but that would be an easy way to generate the list in vim.
>>
for an unkknown reasons, i love everyone in this thread. mb its because you guys helped me everytime i ask for help. i m generally aggressive and hateful person, i guess there is hope for everyone. share the love
>>
>>51252645
As I said, it's not a home assignement. I used the term 'word' because originally this problem came up during my automata theory classes.

> just write a one liner that takes the "index" or whatever that means, store it in an integer and mod it by N -> store it, will be last element in word, then divide the index integer by N -> store it, attach last element to this word and you are done.
You didn't even think for once second, did you? Canonical order =/= lexicographical order.
>>
>>51252709
That was literally taken from the C99 rationale document though.
>>
>>51252684
Ah, I see. Okay. Here it is then.
def get_word(N, i):
res = ""
while i > 1:
res = str((i+N-2) % N) + res
i = (i + N - 2) / N
return res or 'e'

Cute problem
>>
>>51252725
Yeah, that's one way to do it. There is no (to my knowledge) a simple formula but it's possible to generate the word without generating all previous ones.
>>
>>51252771
I think it is a very good set of principles and if we followed it we wouldn't have bad languages like C++ and Java.
>>
>>51252747
We love you too. No homo.
>>
>>51252550
I used to use the WinForms designer a lot in my first few years programming
But nowadays I find it faster and easier to just create the GUI procedurally
>>
>>51252782
just realized that it could have been
res = str((i - 2) % N) + res


oh well
>>
>>51252827
Really? I find winforms designer a hell of a lot easier, it's the WPF one that's difficult to make things with without writing code.
>>
>>51251692
I'm in college but I'm like a fucking child in terms of creative academia. How do people come up with their {Bachelor,Master,Doctoral} thesis? Like, that seems pretty fucking hard even though I'm good at programming and math.
>>
>>51252860
Well, if you are going to that anon's college, you pick a really easy project that has been done a million times before and then code it up with some shitty proprietary libraries and maybe attach an essay explaining what it is and why it sucks
>>
>>51252860
I use my other hobbies as a source for inspiration and programs that I use that miss features I could elaborate on in my own program.
>>
>>51252303
so, essentially the problem is to convert a base 10 in to a different base, with a little bit of arithmetic?
>>
>>51252782
did you even test your shit
>>
File: program.webm (589KB, 1296x758px) Image search: [Google] [Yandex] [Bing]
program.webm
589KB, 1296x758px
I wrote a program that pixelizes videos! How large the pixels are is dependent on the mouse X position. Here's the source:

import processing.video.*;
Movie forest;

void setup() {
size(1280, 720);
forest = new Movie(this, "words.mov");
noStroke();
forest.loop();
forest.volume(0);
forest.jump(25);
}

void draw() {
//tint(255, 20);
int counter = int(map(mouseX, 0, 1280, 5, 30));
for (int x = 0; x < width; x += counter) {
for (int y = 0; y < height; y += counter) {
fill(forest.get(x, y));
rect(x, y, counter, counter);
}
}


}
// Called every time a new frame is available to read
void movieEvent(Movie m) {
m.read();
}
>>
>>51252913
I'm sorry for the bad quality, and please excuse the screenpresso bullshit.

How does it look?
>>
>>51251359
Does Code Golfing make you a better programmer?
>>
>>51252817
Speak for yourself.
>>
>>51252908
yup, works fine
>>
>>51252856
The designer can get a bit tricky with lots of nested controls
And it's pretty handy if you just have to change a single variable to affect multiple controls

WPF is garbage in general
>>
>>51252913
Just imagine how hard the C fags would struggle to make a program like this.
>>
>>51252922
>I'm sorry for the bad quality
Isn't that the entire point of the program?
>>
>>51252902
For my projects I like to tie my other classes into it
I like chemistry so I'll write a program that solve a bunch of conversions and equations for me and that sort of thing

as a bachelors project it'd be something much more complicated but I could see something like cloning orbitalViewer (calculating statistically probably orbital fields based on repulsion factors and number of electrons in your valence)
>>
How to stop a window from being accessed via alt-tabbing... Any suggestions anon
>>
>>51252949
*probable
>>
>>51252922
It looks utterly useless
>>
File: pic-related.png (7KB, 388x200px) Image search: [Google] [Yandex] [Bing]
pic-related.png
7KB, 388x200px
>>51252935
>>
>>51252944
And imagine how much faster it would run.
>>
File: kKfpe6G.jpg (250KB, 800x532px) Image search: [Google] [Yandex] [Bing]
kKfpe6G.jpg
250KB, 800x532px
>>51252537
update: looks like there is a more simple playlist option for mpv


#!/bin/bash                                                                                                             

curl $1 2>&1 | grep -o -E 'href="([^"#]+)"' | cut -d'"' -f2|uniq|grep webm |sed -e 's/^/https:/'>playlist.txt

mpv --playlist playlist.txt
>>
>>51252913
make the framerate 60
>>
>>51252974
it just werks
>>
>>51252944
Just imagine how slow that program would run if all of the heavy lifting done in the background were written in a high level language instead of C.
>>
>>51252950
change its window style so it doesn't show up in the task bar
>>
>>51252947
I meant of the Webm. It looks surprisingly nice when ran. Very comfy in my opinion.

>>51252963
If things needed a use to exist then you wouldn't be here.

>>51252977
Find some 60fps footage and put this in the setup.
frameRate(60);
>>
>>51252974
Don't run my python2 code in your filthy python3 interpreter. Here, a python3 compatible version for your autism
def get_word(N, i):
res = ""
while i > 1:
res = str((i - 2) % N) + res
i = (i + N - 2) // N
return res or 'e'
>>
>>51252942
You know, I can never figure out whether WPF is meant to be good or not.
When I used it it was a hunk of shit.
When I look around the internet I see people saying
>WinForms is old and WPF is the replacement
>WinForms is no longer being supported, better start using WPF if you want to make programs for windows >8
>WPF is much better for [reasons]
It just seems to be missing a ton of features and some features are worse than before.
>>
>>51252996
your webm is definitely less than 24 fps is what I'm saying

looks more like 15
>>
>>51252782
Shit man. Now I'm embarassed to post my solution:
public Word(int canonicalIdx, int alphabetSymbolCount)
{
int length = 0;
for (int acc = 0; ; length++)
{
acc += Mathematics.IntPow(alphabetSymbolCount, length);
if (canonicalIdx <= acc) break;
}
int relativeIdx = canonicalIdx - new Word(new int[length]).GetCanonicalIndex(alphabetSymbolCount);
_word = Mathematics.ToBaseN(relativeIdx, alphabetSymbolCount, length);
}
>>
>>51252391
>damage control
>>
>>51252283
>>51252371
[butthurt intensifies]
>>
angular, node, express, and mongo :^)
>>
>>51253003
>python is so good!
>you should change and stop using your silly lisps / Cs / MLs / anything
>except when it gets new features, I don't personally like change
pythonistas everyone
>>
>>51252989
I'm obviously very autismal so correct if I'm wrong. I'm using node WebKit and removed it from the taskbar but I still see it when alt-tabbing, I'm going to use c++ handles to prevent focus but I don't think that'll stop it from being seen in the windows manager interface (alt-tabbing/win-tabbing)
>>
>>51252944
The code could look pretty much identical provided you had little "simple_gfx.h" and "simple_movie.h" libs.
>>
>>51253020
>if (canonicalIdx <= acc) break;
>empty for loop conditional

Uhh....
>>
>>51253080
Did you mean Mongo, Express, Angular and Node? The order matters mate.
>>
>>51253107
I don't want loop to check the condition before the first iteration.
Do-while would probably be a better idea but whatever.
>>
>>51253136
>Do-while
I use that so little I nearly forgot it exists.
>>
>>51253109
kek, thanks for the correction, m8
>>
File: program.webm (2MB, 845x477px) Image search: [Google] [Yandex] [Bing]
program.webm
2MB, 845x477px
>>51253013
Honestly, every screen recorder tanks the FPS due to my computer being terrible. Here's another video where's it's *slightly* better.
>>
Would NASA be upset at me if I had profanities in my code on GitHub? Applying for an internship.
>>
does khan academy have CS courses?
I wanna master C.
>>
>>51253136
Hmm... you could just && it with length. Or use my awesome solution >>51253003
>>
>>51253198
They probably won't even look at it.
>>
>>51253204
>master C
>khan academy
lol
read a book
>>
>>51252303
unreadable C follows
#include <stdio.h>
#include <math.h>

int main(int argc,char **argv) {
int base = atoi(argv[1]);
int index = atoi(argv[2])-1;
if (!index) {
printf("e");
return 0;
}
if (base < 2) {
return 0;
}
int targetIteration = 1;
while ((1-pow(base,++targetIteration))/(1-base) < index+1) {}
index -= ((1-pow(base,targetIteration-1))/(1-base))-1;
int i,currentPower,currentDigit;
for (i=targetIteration-2;i>=0;i--) {
currentPower = (int)pow(base,i);
currentDigit = (index-1) / currentPower;
printf("%d", currentDigit);
index -= currentDigit*currentPower;
}
return 0;
}
>>
>>51253204
You're not "mastering" anything through Khan Academy, and no they don't have anything C related if I remember correctly.

Please don't fall in to the meme/trap that is C.
>>
>>51253210
alright, cool thanks
>>
>>51253008
People are just repeating what Microsoft says, even though WPF has been abandoned for years now

I personally only found it useful to display images because you can move/resize them on the GPU
But even there I quickly switched to a DirectX WinForms control because WPF startup times aren't very nice

And it's slower than WinForms in all other areas as well
>>
>>51253231
>Please don't fall in to the meme/trap that is C.
I love this "C is a meme" meme.
Upboated XDD
>>
>>51251359
Rewriting linux kernal in vb
>>
>>51252913
cool stuff! this could also be done (and probably more efficiently) with a GPU pixel shader program

Also, using the average value for the pixel (or in your case, just skipping various pixels) doesn't give a very good pixelized style

there are some techniques you can use to downsample things to look more 8bit, but
anyways, cool idea!
>>
>>51253235
Well, they *might*. But they wont be looking through your commit messages or anything so make sure there just isn't loads visible and you'll be fine.
>>
>>51253293
>probably more efficiently
>>
>>51253249
WinRT is now the new thing, right?
>>
>>51253309
I just have shit like
if (!thingthatisntworking()) puts("FUCK");

I'll get rid of them and commit a few times just in case
>>
>>51253293
Oh, it most definitely would be better. I'm just playing around with some stuff in Processing at the moment and thought I'd throw it together.

What would you say is the best method to get a "good" pixelized style?

>>51253318
Speaking in absolutes when talking about anything technical either makes you an expert or retarded. Some people aren't either.
>>
>>51253334
I wouldn't go out of my way to include things I would be embarrassed if I had to explain in an interview.

>somewhere in the code "obama doesn't care about black people" is nested into a function that will never be called or in comments sporadically littered throughout
>>
>>51252976
My 4chan download script does

files=($(curl "$url" | grep -o "i\.4cdn\.org/$board/[[:digit:]]\+\.\(gif\|jpg\|png\|webm\)" | sort | uniq))
>>
>>51253364
>What would you say is the best method to get a "good" pixelized style?
Limited amount of colours that fit nicely. No single pixels, only clusters.
>>
File: Slide058.jpg (57KB, 960x720px) Image search: [Google] [Yandex] [Bing]
Slide058.jpg
57KB, 960x720px
>>51252771
I love how people love to claim they designed the C rational when it was an accident of history
>multics cancelled, Thompson is dicking around with pdp-7 which by that time is a dinosaur collecting dust
> makes video game, adds file system, adds editor, with Ritchie's help this slowly morphs in OS.
>memory is so tiny BCPL is only compiler that will run on it
>Ritchie turns B, a typeless interpreted language into a compiled semi-typed language
>home computer age starts, C and Pascal only two compiled languages in common use. C wins because it was designed to exist in tiny memory space from the beginning
>>
Reminder that 'programming' anything other than in C or lisp makes you a code monkey.
>>
>>51253436
what about C++
>>
I now finally understand the phrase "monads perform capture avoiding substitution".

Substitution is started using `fmap` and finished with `join`. Which, of course give you `>>=` when composed together.
>>
>>51253440
especially C++
>>
>>51253331
I've never used it, but considering it's intended for Windows Store Apps and doesn't work on Windows 7...

>>51253364
It would literary be about 1000 times faster using a shader
>>
>>51251600
The original LISP didn't have that parentheses syntax.
The LISP 2 project was going to have a surface syntax and an internal syntax.
http://www.softwarepreservation.org/projects/LISP/lisp2/TM-2710-101-00-LISP_2_Primer.pdf
>>
>>51253219
>atoi(argv[1]);
Undefined behavior nigga, you have to check argc before accessing that shit.
>>
>>51253414
Accident or not, it turned out very well.
>>
>>51253364
not exactly sure, I just remember using this shader one time and it looked like crap

https://web.archive.org/web/20150905100717/http://www.lighthouse3d.com/opengl/ledshader/
>>
Friendly reminder that every program written in non-OOP language doesn't translate to reality and is, therefore, inferior by design.
>>
Why do strings have to be so annoying?

>have to create a special string object
>can't dynamically change the contents of the string without a bunch of object functions to make sure it's the right length in memory at all times
>have to constantly create and delete strings just to change punctuation
>>
>>51253485
Uh, don't do that then™.
>>
>>51253465
Not a thousand times faster to write :^)
>>
>>51253494
>nobody will ever solve strings
>>
>>51253491
Computations don't exist in reality though.
>>
>>51253494
Don't blame whatever language you are using's shitty implementation of strings on strings in general.
>>
>>51253554
Objects, actions associated with them and interactions between them do.
>>
can anyone who knows Python/Flask tell me why this is giving me an internal server error?

@app.route('/books')
def books():
url = urllib.request.urlopen("http://www.amazon.com/gp/search/ref=sr_pg_1?fst=as%3Aoff&rh=n%3A283155%2Cn%3A5%2Cn%3A3839%2Cn%3A3944%2Ck%3Aprogramming&keywords=programming&ie=UTF8&qid=1447025233")
soup = BeautifulSoup(url)
links = soup.findAll('img', src=True)
for link in links:
print(link['src'])
>>
>>51253578
Nope.
>>
>>51253569
No. Strings are bullshit, and it's the fault of character arrays for existing.

>can't declare a string
>can't do a simple = "..." and change to a simple = "not ..." later
I mean, fuck. Why do I have to implement my own operator functions?
>>
reminder that if your language distinguishes between ``operators'' and "procedures" it's shit
>>
>>51253594
try
url = urllib2.urlopen('http://www.amazon.com/gp/search/ref=sr_pg_1?fst=as%3Aoff&rh=n%3A283155%2Cn%3A5%2Cn%3A3839%2Cn%3A3944%2Ck%3Aprogramming&keywords=programming&ie=UTF8&qi').read()
>>
>>51253641
operators have precedence, dipshit.
>>
>>51253494
Make your own string object, instead of it being a character array make it a character list.
C# has something similar called StringBuilder.
>>
>>51253662
>what is lisp
>>
>>51253662
lel
>>
>>51253688
>hey, let's confuse and mixup everything, right ?
lisp doesn't has any operators, only procedures. dipshit.
>>
>>51253688
Lisp has '(' and ')' as special tokens.
The only requirement a language should have is just some distinguished word separator (say white space), everything else should be re-definable.
>>
>>51253656
>>51253594
>urllib
why
you've already installed flask, go install requests
>>
>>51253740
>what is modifying the reader
Just learn lisp before you talk about it ok buddy.
>>
File: 1442534310070.jpg (214KB, 345x336px) Image search: [Google] [Yandex] [Bing]
1442534310070.jpg
214KB, 345x336px
I love making very specific code for very specific problems. To hell with abstraction.
def search(arr, val):
""" if val is in arr, return val.
if val is in a subarray in arr, return the subarray"""
for i in arr:
if i == val:
return i
elif isintance(i, list):
tmp = search(i, val)
if tmp == val:
return i
>>
>>51253783
>I love making very specific code for very specific problems.
>python
:^)
>>
>std::set in C++ does NOT guarantee the uniqueness of its elements
ALL HAIL C++!
>>
>>51253778
In what language are you gonna write those reader macros?
>>
>>51253739
b-but muh precedence, dipshit
>>
>>51253742

i already have it installed. What parts of the code do i change?
>>
a CS teacher at my school says python is an interpreted version of C++
>>
>>51253839
The best one.
>>
To be honest, people mocking other each others favorite languages is very confusing for me as a noob. It feels like I've made a wrong choice.
>x is a meme
>loving "x is a meme" meme
>x >epic :^)
>using x >2015
>using anything but x
>reminder than only plebs use x
>>
>>51253742
instead of
url = urllib.request.urlopen("http://www.amazon.com/gp/search/ref=sr_pg_1?fst=as%3Aoff&rh=n%3A283155%2Cn%3A5%2Cn%3A3839%2Cn%3A3944%2Ck%3Aprogramming&keywords=programming&ie=UTF8&qid=1447025233")

do
url = requests.get("http://www.amazon.com/gp/search/ref=sr_pg_1?fst=as%3Aoff&rh=n%3A283155%2Cn%3A5%2Cn%3A3839%2Cn%3A3944%2Ck%3Aprogramming&keywords=programming&ie=UTF8&qid=1447025233")

and instead of
soup = BeautifulSoup(url)

do
soup = BeautifulSoup(url.text)
>>
>>51253865
>he fell for the CS degree meme
>>
>>51253867
>The best one.
Seems kinda pointless to write lisp reader macros in Forth, just use Forth for everything instead.
>>
>>51253889
Welcome to /dpt/
>>
>>51253889
>he fell for the /g/ meme
>>
>>51253865
a CS teacher at my school refers to running python code in an IDE (by clicking the run button) as compiling it
>>
I've never done anything graphics related before

I've been thinking of doing like a 2d graphics engine from scratch, how does this sound:

>have functions to do everything
>function pixel takes 2 integers x y and returns tuple (x,y)
>function line takes 2 two-tuples s e (for startpoint and endpoint) and returns an array with all pixels needed in between to make that line
>function box takes 4 tuples and returns an array of arrays, each array would have pixels for each side of the box
>more functions for more shapes
>functions for tilting and moving shit

I have a book on the algorithms used to make lines and shit correctly.

And then I would write something to go with that to actually take the data and draw it into graphics. It wouldn't matter what graphics library I used, I could use javascript even. It would be flexible.
>>
>>51253899
>pretending to be a retard
anon...
>>
This
https://github.com/AlessandroSpallina/JASM
>>
>>51253687
>make your own string object
THUS IS THE PROBLEM

WHY THE FUCK SHOULD I HAVE TO DO THIS?

It's literally ALWAYS the answer when someone says something about strings.

>make your own string object
Why the fuck should I have to do all this backend shit when all I want to do is quickly make some shitty text change to different shitty text. Starts with that, then suddenly I'm reading through buffer class explanations, and how to encapsulate and use polymorphism in case I want this that and the other. I just want to change some fucking text and get back to what the program is SUPPOSED to be about.
>>
>>51253889
>To be honest, people mocking other each others favorite languages is very confusing for me as a noob. It feels like I've made a wrong choice.
All languages are shit. It's not that hard.
>>
>>51253892

thanks but im still getting error 500
>>
>>51253912
>bait
>>
>>51253889
/g/ isn't a good place for aspiring programmers. half of people have no idea what they're talking about and the most complicated thing they've coded is a fizzbuzz.
>>
Every one of these threads are the same.

>Someone actually makes a well thought out post.
>Get a 17 year old memer reply with "C++ ;^)"

80% of you faggots aren't even programmers.
>>
>>51253912
Every program employing 2D graphics is done with sprites. There's no need to specifically address individual pixels. Just build a black box outline for every sprite and move those around.
>>
>>51253889
A lot of languages are good as first, specially C++, Java or C#.
You will learn lots of other languages in the future anyway, it doesn't matter much which you learn first
>>
>>51253924
just use javascript, family
>>
>>51253899
>implying that forth and scheme don't share the throne for best languages
there is no need to fight
>>
>>51253889
They're called "holy wars" because each side is sure they are right and will keep repeating it ad nasueum. Imagine being a noob at theology and walking into a group arguing with each other over why their religion is right and everyone else's is wrong.

Just ignore.
>>
>>51253945
desu baka
>>
I'm building a random quote generator, using a quote storing API. I can make the necessary AJAX/JSON calls to the API without a problem, and displaying those quotes is fine too.

However, I'd like to place the last 5 previously generated quotes within a <p> element below the currently displayed quote. Whenever I run my code, nothing happens with the previously generated quotes, which I've stored within an array. I'm not really sure why, as my code all seems to make sense to me.

$("#newQuote").click(function( ) {


$.getJSON(address, function(quote) {
/*JSON CODE */
/*INSERTS QUOTE INTO HTML*/
}); // end .getJSON

var prevText = []; // array for previous quotes
prevText.push($("#quoteText").html); // push the currently displayed quote into this array

if(prevText.length > 5) {
prevText.shift();
} // if there are more than five quotes, remove the sixth quote

$("#prevQuote").empty(); // empty the html content of the <p> element containing the previous quotes

for(var i = 0; i < prevText.length; i++) {
$("#prevQuote").append(prevText[i]);
} // loop through the array to populate the <p> element with each stored quote
}); // end .click
>>
>>51253945
Go away C++ memer
>>
>>51253945
welcome to any board, shitlord
>>
>>51253934
what desu
>>
>>51253974
I hate c++
>>
>>51253954
>C++ is a good programming language for beginners
>>
>>51253984
>hate c++ meme
>>
>>51253971
>>51253974
>>51253980
look the virgin meme squad is here

baka desu lads, back to ricing arch linux 4 u
>>
>>51253995
>baka desu
family...
>>
This was posted on a forum I sometimes visit
>>
>>51253973
>web "programmer"

Just... good luck out there, yeah?
>>
>>51254010
BTFO
T
F
O
>>
>>51254021
>muh wizardry


lmao scrub
>>
>>51254010
Jesus...

You play any deadman mode m8?
>>
>>51254040
>scrub
>uses js
m8...
>>
>>51254010
What's the point of that program? An ID for what?
>>
>>51253892

ok i fiddled around with it some more im still getting the error but it at least prints the URL's in the command line. It's just not showing in the browser
>>
>>51254059
>assimilating the epic memes of a rwandan carpentry forum
>spouting them non-ironically

step it up
>>
>>51254076
because you're doing print instead of return
>>
>>51253924
>then suddenly I'm reading through buffer class explanations, and how to encapsulate and use polymorphism
Oh, so you just started programming.
Then stop complaining, you know nothing about the language and are probably doing it wrong anyway so you have no right to complain.
>>
>>51254067

Its meant to be an alternative to IP bans. instead, a random ID is generated for each user CLIENT-SIDE, hidden, and that ID is checked on login server-side to see if the user's computer is "banned" or not.
>>
>>51253924
>I just want to change some fucking text and get back to what the program is SUPPOSED to be about.
this is what happens when you don't use MLs or lisps. Sorry bro it's just life.
>>
>>51254138
has anyone told this individual that they're retarded?

>only works on windows
math.pow("lel", 10)
>>
>>51254076
just a tip, try
app.debug = True

this should make your life easier, figuring out why shit won't work
>>
>>51254092

thank you senpai
>>
>>51254173

where do i put that? i tried at the bottom but it gave me error
>>
File: 1420677343767.gif (2MB, 238x178px) Image search: [Google] [Yandex] [Bing]
1420677343767.gif
2MB, 238x178px
>>51253443
Also, "pushing" the de Bruijn `succ`s down the tree during `join` is implemented using `sequence` from Traversable.
>>
>>51254203
I assume it'd go right after
app = Flask(__name__)
>>
File: 1326761046227.png (17KB, 960x526px) Image search: [Google] [Yandex] [Bing]
1326761046227.png
17KB, 960x526px
Does anyone know what font, color scheme? pic related. Thanks!
>>
>>51254092
>>51254173

ok guys unforuntely it looks like amazon prevents you from scraping their images. A captcha image loads instead

do i have to find another site or is there a way around this?
>>
>base operand of '->' has non-pointer type 'JNIEnv {aka _JNIEnv}'

JNIEXPORT jobject JNICALL Java_foo_Bar_malloc(JNIEnv *env, jclass clazz, jint numBytes) {

if(!(numBytes & 1)) (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/OutOfMemoryError"), "malloc");

return env->NewDirectByteBuffer((char*) malloc(numBytes), numBytes);

}


i'm trying to replicate
sprintf(exBuffer, "NE%4.4X: Caller can %s %s print", marker, "log", "or");
(*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/Exception"), exBuffer);

http://stackoverflow.com/questions/230689/best-way-to-throw-exceptions-in-jni-code

to see if i can throw a java exception from native code
>>
>>51251359
How much is b?

int a = 3, b;

b = ++a + ++a + ++a + ++a + ++a + ++a + ++a + ++a + ++a + ++a + ++a + ++a;

>>
>>51254138
Can't you just delete the file?
I'm sure it'd be simple to find it.
>>
>>51254265
8bait
>>
>>51254265
is it even defined in C/C++?
>>
>>51254216
that's the scheme all the skiddies on /wg/ use for their ricer desktops iirc
>>
>>51254263
>http://stackoverflow.com/questions/15764948/error-base-operand-of-has-non-pointer-type-jnienv
oh
>>
>>51254260
tip: set the user-agent header
most sites correctly classify requests/urllib as robot-like and give you a captcha
this should work
url = requests.get("http://www.amazon.com/gp/search/ref=sr_pg_1?fst=as%3Aoff&rh=n%3A283155%2Cn%3A5%2Cn%3A3839%2Cn%3A3944%2Ck%3Aprogramming&keywords=programming&ie=UTF8&qid=1447025233", headers={'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0'})
>>
>>51254311
nope
>>
>>51254265
wait that's wierd
it should be 36 but it's 114
>>
>>51254352
It's defined through sequence points, you noob.
>>
File: bait.gif (3MB, 500x207px) Image search: [Google] [Yandex] [Bing]
bait.gif
3MB, 500x207px
>>51254265
>>
>>51254357
No, why would it be 36?
>>
>>51254343

tried that. Didn't get the captcha image, but didnt get the images. Just blank

I used a page from books.google.com and it worked. I guess Amazon really doesnt like web scrapers?
>>
>>51254383
and where are those?
>>
>bump limit reached
>>
>>51254357
>>51254421
It's undefined.
>>
>>51254475
>too scared to just make a thread
>>
>>51254383
>I don't know what I'm talking about
>>
Building a text editor in C++
>>
File: umarusummer.jpg (56KB, 848x480px) Image search: [Google] [Yandex] [Bing]
umarusummer.jpg
56KB, 848x480px
>>51254265
easy for a programming literate.

b = (((15*15) + 15) / 2) - ((((3*3) + 3) / 2)
b = ((225 + 15) / 2) - ((9 + 3) / 2)
b = (240 / 2) - (12 / 2)
b = 120 - 6
b = 114
>>
new thread -> >>51254500
new thread -> >>51254500
new thread -> >>51254500
>>
>>51254493
>>51254421
ok ++a means add 1 to the value of a(3) before checking the value

(+1) + 3 = 4 the first time. a is now 4
then add 1 to that value (5) + 4 = 9.

eventually it's going to be pretty big, 114 big to be precise
>>
>>51254493
In what way is it undefined? ++a is clearly defined, and plus is clearly defined. it should add up to 114.
>>
>>51254550
++a is defined
++a + ++a is not
>>
>>51254430
works for me
from flask import Flask
import requests
from bs4 import BeautifulSoup
app = Flask(__name__)
app.debug = True
@app.route('/books')
def books():
url = requests.get("http://www.amazon.com/gp/search/ref=sr_pg_1?fst=as%3Aoff&rh=n%3A283155%2Cn%3A5%2Cn%3A3839%2Cn%3A3944%2Ck%3Aprogramming&keywords=programming&ie=$
soup = BeautifulSoup(url.text, 'html.parser')
links = soup.findAll('img', src=True)
images = ['<img src="%s"></img>' % link.get('src') for link in links]
return str(images).strip('[').strip(']')

if __name__ == '__main__':
app.run()
>>
>>51254546
>a is now 4
It's not.
>114 big to be precise
Nope, undefined.
>>
>it's undefined
>the compiler knows this is undefined
>it compiles
llllllllllllllllllel
>>
>>51254632
>&ie=$
I had a copy/paste issue, sorry
from flask import Flask
import requests
from bs4 import BeautifulSoup
app = Flask(__name__)
app.debug = True
@app.route('/books')
def books():
url = requests.get("http://www.amazon.com/gp/search/ref=sr_pg_1?fst=as%3Aoff&rh=n%3A283155%2Cn%3A5%2Cn%3A3839%2Cn%3A3944%2Ck%3Aprogramming&keywords=programming&ie=UTF8&qid=1447025233", headers={'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0'})
soup = BeautifulSoup(url.text, 'html.parser')
links = soup.findAll('img', src=True)
images = ['<img src="%s"></img>' % link.get('src') for link in links]
return str(images).strip('[').strip(']')

if __name__ == '__main__':
app.run()
>>
>>51254533
>literate
>anime
>wrong
checks out
>>
File: umaru.jpg (282KB, 640x961px) Image search: [Google] [Yandex] [Bing]
umaru.jpg
282KB, 640x961px
>>51254631
the order of evaluation is not defined but the oder doesn't matter here because of the commutative property of addition. if it was something like (++a) / (++a), then the order matters.
>>
>>51254694

thanks i'll try this, but do you know why THIS version only displays the first image it finds and not all of them?

@app.route('/books')
def books():
url = requests.get("http://www.barnesandnoble.com/s/computer+programming/_/N-8q8?_requestid=268976", headers={'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0'})
soup = BeautifulSoup(url.text, 'html.parser')
links = soup.findAll('img', src=True)
for link in links:
return "<img src=" + link['src'] + ">"
>>
>>51254716
it does matter
>>
>>51254716
the compiler can tell you to go fuck yourself
>>
>>51254744
because you're returning in a loop
>>> def example():
... for i in range(1, 100):
... return i
...
>>> example()
1
>>>
>>
>finally figured out the mark-sweep
Getting the right live condition is actually the hardest part baka desu senpai imo.
>>
>>51254744
this is probably what you want:
from flask import Flask
import requests
from bs4 import BeautifulSoup
app = Flask(__name__)
app.debug = True
@app.route('/books')
def books():
url = requests.get("http://www.amazon.com/gp/search/ref=sr_pg_1?fst=as%3Aoff&rh=n%3A283155%2Cn%3A5%2Cn%3A3839%2Cn%3A3944%2Ck%3Aprogramming&keywords=programming&ie=UTF8&qid=1447025233", headers={'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0'})
soup = BeautifulSoup(url.text, 'html.parser')
links = soup.findAll('img', src=True)
images = []
for image in links:
images.append('<img src=' + image.get('src') + '/>')
return ''.join(images[1:-1])

if __name__ == '__main__':
app.run()
>>
>>51252944
>convert the MP4 or whatever to raw images
>modify the images to be blocky depending on the mouse position
>put the raw images onto the screen via OpenGL or something
>play sound
>repeat
It isn't that hard. The worst thing here is converting MP4 to RAW, but that isn't that hard anyways.
>>
>>51254216
That is in fact the best font, terminus, but it is not the best colorscheme, which is Jellybeans.
>>
>>51254780
and what does say the c11 standard at 5.1.2.3 Program execution ?
>>
>>51254851
sorry I keep making so many mistakes
from flask import Flask
import requests
from bs4 import BeautifulSoup
app = Flask(__name__)
app.debug = True
@app.route('/books')
def books():
url = requests.get("http://www.amazon.com/gp/search/ref=sr_pg_1?fst=as%3Aoff&rh=n%3A283155%2Cn%3A5%2Cn%3A3839%2Cn%3A3944%2Ck%3Aprogramming&keywords=programming&ie=UTF8&qid=1447025233", headers={'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0'})
soup = BeautifulSoup(url.text, 'html.parser')
links = soup.findAll('img', src=True)
images = []
for image in links:
images.append('<img src="' + image.get('src') + '" />')
return ''.join(images)

if __name__ == '__main__':
app.run()

I think this is what you want
that one has an issue, it does
<img src=amazon.com/whatever.jpg/>

instead of
<img src="amazon.com/whatever.jpg" />
>>
>>51253494
what language is this?
>have to create special string object
char* in C?
>>
>>51254885
what does this say: >>51254970
>>
>>51254994
that you don't know c
>>
>>51255033
no u

you said it was 114 but that guy got 115
>>
>>51254908

thanks everyone for the help

do you mind explaining the last return line?

return ''.join(images)


is that just printing out the array of images? looks confusing
>>
>>51253889
Here is a legit list of programming things WITHOUT any mockery and memes:
C is meant to be fast and it is old, since the dawn of modern computing old. C is the building blocks of major pieces of software like the Linux kernel, GNU ecosystem, most embedded software, and the majority of old software otherwise.

C++ is C with more advanced features. It has a lot of them and it is rather complicated. Most people either use this or Java when it comes to non-web userspace applications (Chrome, games, anything running on the computer that you would use).

Java is rather similar to C++ in the sense they both use what is called object oriented programming (or OOP). This states that variables are seen as objects and can hold other variables. So I can make an object called "cat_t" and have it contain not only variables, but functions that operate on those variables. If you are feeling a bit lost at this point, you might want to look up these terms.

Python is a scripting language meant to be simple.

Lisp is as old as dirt, and I don't know much about it besides I have to use it in Emacs.

Bash is the terminal language used in Linux and Mac OS. Batch is the terminal language used in Windows.

Brainfuck is a gag language meant to be simple and stupid. It is technically turing complete, so every computation possible can be done in Brainfuck.

Haskell is different, because it is a functional language. I don't know much about functional languages, but they seem interesting.

That's about it. If I left anything out, tell me
>>
>>51255046
I didn't say 114
>>
>>51254994
never said it was C.
>>
>>51255079
you don't know what the fuck you're talking about
>>
>>51255069
>>> example_list = []
>>> for i in range(10):
... example_list.append(str(i))
...
>>> example_list
['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
>>> ''.join(example_list)
'0123456789'
>>> ' '.join('ayylmao')
'a y y l m a o'
>>> 'no'.join('asdf')
'anosnodnof'
>>>
>>
The type signature of free() is void free(void *);

If I have code that looks like this:
const char *my_mem = malloc(1);
free(my_mem);

Clang complains because I am passing "const char *" to parameter "char *", discarding qualifiers.

My question is, should I cast to volatile, or should I get rid of const?
/* this */
char *my_mem = malloc(1);
/* or this instead: */
free((char *)my_mem);

OR, should I disable the warning in clang?
>>
>>51255164
https://stackoverflow.com/questions/1876191/explain-python-join
>>
>>51255181
>>> from string import ascii_lowercase
>>> ascii_lowercase
'abcdefghijklmnopqrstuvwxyz'
>>> '-'.join(ascii_lowercase)
'a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-p-q-r-s-t-u-v-w-x-y-z'
>>
>>51255164

thank you based senpai

if i wanted to grab JUST the programming books from the page, how would i do that? also grab the book titles. You don't have to code it for me, just point me in the right direction senpai
>>
>>51255168
why is it declared const?
>>
>>51255125
>>51255143
>moving the goalposts
read the comment chain, doesn't matter what YOU said, you were still arguing for that "side"
>>
>>51255206
right now, you're unconditionally grabbing every image with a src attribute from http://www.amazon.com/gp/search/ref=sr_pg_1?fst=as%3Aoff&rh=n%3A283155%2Cn%3A5%2Cn%3A3839%2Cn%3A3944%2Ck%3Aprogramming&keywords=programming&ie=UTF8&qid=1447025233

if you examine the books, they all have one attribute in common, "Product Details"
so instead of unconditionally grabbing every image (soup.findAll('img', src=True)), only grab the ones that have alt="Product Details"

https://stackoverflow.com/questions/2612548/extracting-an-attribute-value-with-beautifulsoup
https://stackoverflow.com/questions/8933863/how-to-find-tags-with-only-certain-attributes-beautifulsoup
>>
>>51255292
what side?
>>
>>51255327
the one saying that the result is defined in C/C++ to be 114
>>
>>51255345
no, I said it's undefined
>>
>>51255307
after you get that down, finding the title shouldn't be too hard
>>
>>51255373

>>51254716
>the order of evaluation is not defined but the oder doesn't matter here
>>51254780 (Me)
>the compiler can tell you to go fuck yourself
>>51254885
>and what does say the c11 standard at 5.1.2.3 Program execution ?
>>51254994 (Me)
>what does this say: >>51254970

by replying to me and saying that i don't know c or whatever it was that you said you're arguing against me
>>
>>51255421
you just quoted 3 different people talking about different things
>>
File: 1431389665411.gif (973KB, 256x186px) Image search: [Google] [Yandex] [Bing]
1431389665411.gif
973KB, 256x186px
>>51255448
>>
>>51255467
>meme
>>
>>51255307

thank you senpai

do you work as python dev?
>>
>>51255271
Nothing really needs to be const. But sometimes it's nice to have the guarantee of const.
>>
The OO design concept initially proved valuable in the design of graphics systems, graphical user interfaces, and certain kinds of simulation. To the surprise and gradual disillusionment of many, it has proven difficult to demonstrate significant benefits of OO outside those areas.

OO languages make abstraction easy — perhaps too easy. They encourage architectures with thick glue and elaborate layers. This can be good when the problem domain is truly complex and demands a lot of abstraction, but it can backfire badly if coders end up doing simple things in complex ways just because they can.

All OO languages show some tendency to suck programmers into the trap of excessive layering. Object frameworks and object browsers are not a substitute for good design or documentation, but they often get treated as one. Too many layers destroy transparency: It becomes too difficult to see down through them and mentally model what the code is actually doing. The Rules of Simplicity, Clarity, and Transparency get violated wholesale, and the result is code full of obscure bugs and continuing maintenance problems.

Another side effect of OO abstraction is that opportunities for optimization tend to disappear. For example, a + a + a + a can become a * 4 and even a << 2 if a is an integer. But if one creates a class with operators, there is nothing to indicate if they are commutative, distributive, or associative. Since one isn't supposed to look inside the object, it's not possible to know which of two equivalent expressions is more efficient. This isn't in itself a good reason to avoid using OO techniques on new projects; that would be premature optimization. But it is reason to think twice before transforming non-OO code into a class hierarchy.
>>
Can anyone help me? My `map' isn't working properly and I can't figure out why. When I do `map echo 1 2 3' it prints 3 -blank- lines when it should be printing
1
2
3.

When I do `map sh GARBAGE` it does successfully invoke a shell though. So what's going on?
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>

int
execute(const char *execpath, char *arg) {
int status = 0;

pid_t pid = fork();
if (pid < 0) {
perror("fork");
return status = 1;
} else if (pid == 0) {
char *const args[] = { arg, NULL };
if (execvp(execpath, args) < 0) {
perror("execvp");
exit(1);
}
} else {
while (wait(&status) != pid)
;
}
return status;
}

int
map(const char *execpath, char **args) {
int status = 0;
while (*args)
status |= execute(execpath, *args++);
return status;
}

/* map: map a shell command onto arguments */
int
main(int argc, char **argv) {
if (argc < 3)
return 1;

const char *execpath = argv[1];
char **args = argv + 2;
return map(execpath, args);
}
Thread replies: 374
Thread images: 35
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y / ] [Home]

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
If a post contains illegal content, please click on its [Report] button and follow the instructions.
This is a 4chan archive - all of the content originated from them. If you need information for a Poster - you need to contact them.
This website shows only archived content and is not affiliated with 4chan in any way.
If you like this website please support us by donating with Bitcoin at 1XVgDnu36zCj97gLdeSwHMdiJaBkqhtMK