[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
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 31
File: 20-15-50-maxresdefault.jpg (117 KB, 1280x720) Image search: [Google]
20-15-50-maxresdefault.jpg
117 KB, 1280x720
/dpt/ - daily programming thread

Previous thread - >>55123856


What are you working on, /g/?
>>
What text editor do you prefer to use /g/?
https://www.strawpoll.me/10508463
>>
>Created before the bump limit
Delete this shit and kill yourself.
>>
>>55131326
Whats /g/ opinion on C#? I'm really loving it
>>
>>55131359
shittier bloatier c++
>>
File: 1447734883815.jpg (766 KB, 1278x1202) Image search: [Google]
1447734883815.jpg
766 KB, 1278x1202
Would it be a bad idea to write an imageboard software entirely as a single monolithic CGI script that stores posts in a SQlite database?

I figure I can just generate the page procedurally and then style it later with some CSS.

How does 4chan do it?
>>
>>55131348
Atom, but only because power mode makes bitches panties wet.
>>
>>55131403
Of course but I find it nice I think it gets the job done without being overly uglier like others
>>
>>55131348
I literally can't respond to the strawpoll because the captcha keeps rejecting me and asking me to do more.
>>
>>55131446
It works perfect for me. Have you tried the audio challenge?
>>
File: 1458807275054.jpg (658 KB, 2040x3160) Image search: [Google]
1458807275054.jpg
658 KB, 2040x3160
>>55131411
>How does 4chan do it?
>>
File: lisplogo.png (29 KB, 811x805) Image search: [Google]
lisplogo.png
29 KB, 811x805
Nothing. Taking day off and watching Rocky drinking beer.

I'm the guy who did the basic Clojure database application. I can't for life of me understand why people like dynamic languages. I really missed the information I get straight from signature like

private File getFile(String path) {

Where I can see clearly visibility of method, what it returns and what works as argument. In Clojure it was just like

(defn get-file [path]

which is confusing as fuck and doesn't tell anything about what it works with or produces. Fucking sucks.
>>
>>55131411
kys
>>
>>55131411
Weabfags are autistic.
>>
>>55131411
It depends on whether or not you want it to scale. If you don't care that this will never be able to support thousands of concurrent users, then go for it.

If you do want it to scale, then you're going to want to at least consider a database designed for this kind of use-case.
>>
>>55131493
s/get-file/file-from-path/
>>
>>55131403
>bloatier

who cares?
HDD space is massive these days.

>shittier

way to be vague.
>>
>>55131669
What's the difference between mysql and sqlite other than requiring a separate daemon and a separate login?
>>
>>55131874
mysql isn't even a great db, I'd say postgres.

The problems with sqlite:
>you're limited completely to one machine
>no user management to protect different data
>only a single write can happen at once
>>
How does doom draw? I've tried looking through the code in the source ports, but I see very few instances of (example, let's just stick to SDL) SDL functions. Does doom draw in it's own way and SDL_CreateRGBSurfaceFrom is used to convert it?

I've looked at the struct that contains sidedefs, but i've been unable to find how those textures are stored or even drawn.
>>
>>55131937
What if you have different databases for different things, like posts, images, unique user cookies, banned IPs, etc.
>>
>>55131966
Why would you do that?
>>
I'm working on training neural networks to synthesize musical pieces in the style of one input but with the "content" ie. structure, melody of another. It's similar to what people have done with images. Pic related.
>>
>>55131966
You can always emulate functionality and shard the way you've described. But bear in mind that you are emulating functionality.

SQLite doesn't have network functionality or support for concurrency. It's great for its designed usages (like Firefox storing local information), but it isn't designed for web applications.
>>
File: 1463696945268.png (25 KB, 396x400) Image search: [Google]
1463696945268.png
25 KB, 396x400
>>55131966
>>55131937
>>55132019
use Berkley DB.
>>
>>55132007
Neat. I suspect the output will be garbage though.
>>
>>55132007
Any samples yet?
>>
>learn more C
>go through every C book
>start to feel more confident in my abilities
>open up some random project's code on Github
>constants fucking everywhere
>don't know what any of them are for
>don't know which of the 100+ headers they were defined in
>completely lost
>goto step 1

Do people in the real world just open up code and immediately know what it does? I feel like if this was my job I'd be fired the first day.

https://github.com/systemd/systemd/blob/master/src/systemctl/systemctl.c
>>
>>55132253
I still cannot go through someone else's code
>>
>>55132113
Most likely. I think it has the potential to make some interesting blends given simple enough inputs.
>>55132126
Soon to come. Currently I am still implementing the 'temporal' net.
>>
>>55132253
When you have almost 100 lines of headers included I don't think it's expected you can tell what's happening from one file alone.


And once you start opening a project to hundreds of people it becomes a cluster fuck and what usually happens is people specialize in only one area of the program because there's literally no one that can comprehend it all.
>>
>>55132253
Honestly, I'm not able to into a codebase unless I have a goal.

Try to find an open source project that has beginner hacks, and do those. It's the best way to become familiar with a codebase.
>>
>>55132253
There's a difference between knowing a language and knowing a specific project. It's good enough if you know what any code does syntactically, but you can't realistically expect to understand how the whole system works instantly based on one file.
>>
>>55132253
Do you mean this?

https://github.com/systemd/systemd/blob/master/src/systemctl/systemctl.c#L123

These are just variables for storing cli options.

https://github.com/systemd/systemd/blob/master/src/systemctl/systemctl.c#L6725

Ctrl-F and experience are your best friends. Also, always locate main first.
>>
perl or ruby?
>>
File: 1465406303814.jpg (60 KB, 500x500) Image search: [Google]
1465406303814.jpg
60 KB, 500x500
I'm coding a 4chan thread image scraper right now, and I'm posting a picture here to see if my script sees the update to the thread.
>>
How do I get rid of the question mark on GET query strings?
>>
>>55132431
a query string is defined by that question mark, if you don't want it in the url you'll need to use mod_rewrite
>>
File: 1453303517244.png (48 KB, 336x280) Image search: [Google]
1453303517244.png
48 KB, 336x280
I'm trying round up an integer to the next multiple of some power of two.
I'm using
(n | 0x7FFF) + 1
to round it up to the next multiple of 2^16. However this will increase it another 2^16 if the input is already a multiple of it.
How could I change this expression to not round up if it's already a multiple?
>>
When creating a scalable mobile ui, should I use the display dimensions to position ui elements or is there a better/easier way?
>>
Any suggestions on merging hashes in perl?

I tried using Hash::Merge but it doesn't work.
>>
Is learning java as first language stupid?
>>
>>55132369
It was an arbitrary example. I actually typed the post while reading through torvalds/linux.

I guess the moral of the story is that I don't know how anyone gets large projects done in the real world because reading someone else's code is next to impossible. I thought the whole point of the FOSS meme was that the whole world can collaborate together on something like Linux, but I would not even know where to start editing the code if I wanted to change something. I feel like Lovecraft staring into the black seas of infinity and my being unable to comprehend its vastness and complexity.

Found some more stuff that uses C as well.
https://github.com/vim/vim/blob/master/src/edit.c
https://github.com/FFmpeg/FFmpeg/blob/master/ffmpeg.c
>>
will github get all pissy with me if I don't use their api and instead fake my headers and use a session for committing?

>>55132743
not at all
>>
>>55132253
I've been hired for the first time ever in software, working on already in production software from a professors lab. It took me about two full days before I could actually make meaningful changes to the codebase. Finding the todos: sprinkled around and just exploring how the program control reaches those points from the beginning of execution is a good strategy to start.

>>55132369
>Ctrl-F and experience are your best friends.
and grep
>>
>>55132743
It's probably one of the most stupid things you can do.
>>
>>55132678
foreach (keys %hash1) {
$hash2{$_} = $hash1{$_};
}


I literally just learned perl today

>>55132743
no, Java is an ideal first language, and the most in-demand
>>
>>55132743
Java made me hate programming.
>>
>>55132678
Here, some more context.
use Storable;
use Data::Dumper;
use Hash::Merge qw( merge );

$hash1 = retrieve('images');
$hash2 = retrieve('images2');

print "Hash1:\n";
print Dumper $hash1;

print "Hash2:\n";
print Dumper $hash2;

%combined = %{ merge( %hash1, %hash2 ) };

print "Combined:\n";
print Dumper $combined;


Just gives me undefined.
>>
>>55132743
the people insulting Java hate it because while powerful, it's also wordy as hell and has a few notable inconveniences

Javascript on the other hand is probably the easiest and comfiest to learn, but doing so is a bad idea because if you learn it first you're likely to get pissed off at every more complicated language, which is a shame because despite it's comfiness it's extremely over-specialized
>>
>>55132253
It can be a bitch with larger projects. I've tried reading through the Linux source code, but it's so hard finding a good base point.
>>
>>55132808
$combined = merge( $hash1, $hash2 );
>>
>>55132743
learn scala
>>
Who's the most skilled Windows programmer in the world?
>>
>>55132926

Herb Sutter
>>
File: ceos_gone_wild_by_rware-d3af4f1.jpg (177 KB, 600x740) Image search: [Google]
ceos_gone_wild_by_rware-d3af4f1.jpg
177 KB, 600x740
>>55132926
Steve Ballmer
>>
>>55132926
Julian Casablancas
>>
>>55131419
I really want to like Atom, but its sluggishness drives me crazy.
>>
>>55132891
Alright, I can get it to work there.

Why can't I get it to work here.
Line #45.
http://pastebin.com/1KfzyiAM
>>
What's better /dpt/

Ruby or Perl?

It seems to me that Ruby was intended to fix Perl but it created a bunch of complications that make it less useful IMHO
>>
I'm trying to read asynchronously the output of an NSTask. It's working, but i want to update the Controller of another view in real time.

How can I design a class that will broadcast the piped output in real time so other classes can receive it?

How do I do it?
>>
>>55133112
Just close your eyes while editing text. It won't matter then.
>>
>>55133138
perl is broken beyond repair, and riddled with security vulns, but if you wanna use it, i'm certainly not in a position to influence you to not do so
>>
>>55133210
broken how?
>>
>>55133183
I'm really wanting to get super leet at vim with cool plugins instead.
>>
anyone willing to suggest me some practice project? i'm a CS undergraduate so I can do some shit but never tried to do something challenging. my last project was a text to music conversor which was pretty easy since I used jfugue
>>
>>55133112
Use atom only if you have a good computer. Sublime is faster and has a lot more built-in functionality but it's less expandable
>>
File: 17429012.png (20 KB, 400x400) Image search: [Google]
17429012.png
20 KB, 400x400
I'm learning C++ and I'm up to pointers.

When it's talking about memory address it's talking about it's location in RAM, right?
>>
>>55133308
Yes, though those addresses aren't exactly the same as physical addresses in RAM
>>
coursea (free) is shutting down
here is a dude who uploaded it for torrent

https://www.reddit.com/r/learnprogramming/comments/4oljp8/calling_out_all_seeders_ive_been_uploading_a_few/

it's for the algorithm courses
>>
Best place to learn networking? Also, is it harder to get a job on networking than programming?
>>
>>55131411
4chan uses PHP and mysql

it's nothing fancy at all
>>
>>55133358
I remember years ago when everyone was heralding the era of "free education" and "self-teaching" becoming the new paradigm.

Turns out you can't make money on shitty free online tutorials.
>>
>>55133358
not just algorithms of course, but a few others as well
>>
>>55133368
Is it a monolithic script tho?
>>
>>55133379
it wasn't shitty at all, very good in fact

which is why people are upset it's closing down
>>
>>55131359
>C#
>Windows
HARMFUL
A
R
M
F
U
L
>>
>>55133396
Then why are they shutting down their free courses?
>>
>>55133252
reverse an array with one million assigned elements within 10 seconds
>>
I have a Raspberry Pi, C++ programming knowledge, and some money to blow. What can I do that is really cool? I was thinking about making a digital assistant (turning on stuff, thermostat, making coffee), which is all wired together with chromecast audio and some microphones, but I (suprisingly) want to know what /g/ recommends
>>
>>55133401
mono
>>
>>55133409
because they want to make more money, it will be the same course. But this time charged
>>
>>55133358
>>55133380
>https://www.reddit.com/r/learnprogramming/comments/4oljp8/calling_out_all_seeders_ive_been_uploading_a_few/
uh oh, I need to finish that Calc course, is the entire website shutting down or are they just cutting back?
>>
>>55133422
I guess, but why bother with using C# then? Why not just C++?
>>
>>55133433
it will be a paid model

beside that person uploading the torrents, you can enroll now for a course of your choosing (check r/learnprogramming) and use a script to download all the lectures
>>
>>55133433
They're converting their free courses to paid courses.

>>55133430
So basically the free self-taught CS education meme is over?
>>
>>55133447
>>55133446
if I had already started the course, would I be exempt?
>>
>>55133460
no idea
>>
>>55133480
>>55133480
i almost panicked because I didn't see any progress, but I haven't logged back on since the new redesign, so everything is good
>>
File: hmmm.jpg (21 KB, 393x360) Image search: [Google]
hmmm.jpg
21 KB, 393x360
Anyone knows where or how I can make a JTable unlimited ?
Mine is set to show only 8 rows (don't even know why 8) and I want it to show everything it can (from an sql query) and just be able to scroll down in it.
>>
File: nani.png (304 KB, 722x768) Image search: [Google]
nani.png
304 KB, 722x768
Should I start making commits when my software project is in a usable v0.1 state, or should I start committing from the beginning?
>>
>>55133554
Comment from the beginning, because if you fuck up at any time since the first commit, you can roll back and fix it (not to mention collaborating with other people)
>>
>>55133442
Isn't C# more similar to Java than C++?
>>
>>55133579
good point
>>
I just got the urge to get a Raspberry Pi and write a kernel for it
>>
>>55133579

Yes.
>>
>>55133614
literally why?
>>
>>55133627
No idea, the idea came to me out of nowhere
>>
>>55133660
Doesn't sound like a very good idea, tbqh fampai
>>
>>55133678
I dunno, it seems like it wouldn't cost much and it would be a fun project. Only problem is I would have to learn Arm.
>>
>>55133138

Ruby was not intended to fix Perl. It was mostly inspired by Smalltalk, Lisp, and Python. Where it differs from Python in methodology is what it pulls from Perl - the idea that there should be multiple ways of doing things. Aside from that, and a few bits of syntax pulled from Perl for convenience, Ruby isn't really trying to be Perl. It just so happens that Ruby does Perl's job better than Perl, because it's more readable, more flexible, and it didn't fuck up objects.
>>
File: 1429581742508.jpg (68 KB, 884x666) Image search: [Google]
1429581742508.jpg
68 KB, 884x666
>>55133759
>tfw still haven't read Why's guide

I'm slacking, Ruby. I've done much less programming this summer than usual.
>>
>>55133705

ARM isn't a very difficult instruction set to learn. It's a hell of a lot easier than x86... 'cept for the barrel shifter thing.
>>
>>55133781

I haven't gotten a ton of programming done either... except for a small C program to hex dump all of the files inside of a .zip.
>>
>>55133759
It fucked up regex though, and that's kind of the main strength of perl
>>
>>55133782
I mean, I'd assume it would be a lot easier than x86 (I read through the dev manuals, now I understand why RISC became a thing), it's just I'd have to put in extra effort to learn Arm when I'm already somewhat familiar with x86.
>>
File: output.png (44 KB, 120x187) Image search: [Google]
output.png
44 KB, 120x187
>>55133798

I did that triangle art shit on a lark, but that's about it.
>>
>>55133553
bumping this
>>
>>55133660
the idea is stupid. if you want good ideas, watch >>55133420
>>
>>55133915
How stupid
>>
>>55133980
why bother with making another kernel entirely? Use Linux, if you can't use Linux or don't want to, use *BSD. If you can't use either, you are doing something wrong.
>>
>>55134017
>why bother with making another kernel entirely?
Because it'd be fun
>>
File: hexclock.jpg (75 KB, 1010x860) Image search: [Google]
hexclock.jpg
75 KB, 1010x860
I have a background 20 years ago of beginner C++ and ASM, which I found easy. JS I find really confusing. From all appearances it looks like it should be infinitely flexible, allowing you to just run methods/functions off of absolutely any variable/object. In practice, I find most of what I attempt just doesn't work, and I have no idea why. Navigating the DOM should be easy, and yet after all this time I still can't reliably do it. and I did go and read beginner texts on such, mostly on MDN.

Maybe I just failed to learn JS properly. I got frustrated trying to go through beginner tutorials initially and on other sites, and started an ambitious project to make a ~14+-segment digital clock with a customized hexagonal font.
I initially got it running on the first day by editing someone else's code, mostly done in CS. When I attempted to rewrite it from scratch mostly in JS, it took me 2.5 weeks.
http://codepen.io/NEETWizardJanus/full/OXVwJN/

Once I got to this point I lost momentum in implementing additional features such as animations/resizing between different display modes, a "splash screen" that hides the clock initially, and turning it into a full interactive menu system.
I also got criticism that my code was a huge mess, but I had no idea how to clean it up. I suppose change from individual .attr calls to a single line of .html or something similar. I had problems trying to implement that method of assignment during the 2.5 weeks.

What do you think of my clock, goyim?
>>
>>55134040
no, it won't. trust me on this. if you have that kind of time, you spend way too much time on /g/.
>>
>>55133554
commit from the beginning, if you're using github/bitbucket you don't need to make it public until necessary.
>>
>>55134048
Just compile your C/C++ code to JavaScript with emscripten. If your C is written well, the asm.js optimization will beat out plain JavaScript performance anyway.
>>
>>55134048
>what do you think of my clock
that's a lot of lines, does it count in seconds?
>>
>>55132253
The thing about constants is that you shouldn't worry about the value.
>>
>>55131348
vim master race.
>>
>>55134090
Thanks. I'll give that a look. {gotta dig up that ancient code.}
The C++ was very efficient from what I remember. but it was hard-coded for a specific resolution. heh.

>>55134105
Is it true that time is money? It sure does.
It's designed like a true architectural asshole would: highly impractical for "aesthetic" purposes.
>>
>>55133554
Commit often and squash all of your commits when you release. This is how git is intended to be used for things like new features as well. Nobody wants or needs to see all your shit interim commits.
>>
>>55131493
that's not a property of static vs. dynamic languages, it's a property of implicit vs. explicit typing.
>>55132849
>java
>powerful
http://www.paulgraham.com/avg.html
>During the years we worked on Viaweb I read a lot of job descriptions. A new competitor seemed to emerge out of the woodwork every month or so. The first thing I would do, after checking to see if they had a live online demo, was look at their job listings. After a couple years of this I could tell which companies to worry about and which not to... You were also safe if they said they wanted C++ or Java developers.
>>55133781
>>55133798
same here boys :^( haven't made anything the past few weeks and im all out of ideas
>>
unsigned char * const memory = 0;

memory[0x...]

Why does nobody do this?
>>
>>55134431
Because it's stupid and there is literally no reason to.
>>
>>55133759
What OS, WM and text editor/IDE do you use?
>>
>>55134445
Memory mapped IO
>>
>>55134431
It's undefined behavior. You'd think a systems language would let you do that, but that's not what the standard says.

Retards on /g/ will get mad because they think C is "how the computer works."
>>
>>55134431
The OS will stop you.
>>
File: 235235.jpg (63 KB, 845x506) Image search: [Google]
235235.jpg
63 KB, 845x506
>>55134522
What's the undefined part about it?

>Retards on /g/ will get mad because they think C is "how the computer works."
Pic related
People fail to understand it's a high level language

>>55134547
I didn't mean memory[0] I meant memory[0x0a35] or something
>>
Where the fuck are the exercises in the python version of SICP

there's just projects
>>
>>55134558

C is assembly++ :&)
>>
>>55134522
>>55134558
Regardless of it being undefined behavior, C will allow you to do that. I started writing an OS as a small project, and I was able to initialize pointers directly with with whichever memory address I picked (very dangerous though). The only thing that gets in your way is the OS you're developing on (assuming you're not using an OS that uses a flat memory model).
>>
>>55134558
>I didn't mean memory[0] I meant memory[0x0a35] or something
Most modern operating systems will just have you addressing memory specific to the process. Operating systems make processes believe they actually have access to the entire memory.
>>
Hi /g/uys, I would like to ask something thay maybe lot of people asked, so sorry if I'm doing that.

I like coding and I try to finish a course on codeacademy. Maybe is not good but at least is something. Thing is, I can't code everyday because I'm dense and I end giving up because I think "I should be able to solve it since I did it before" and I let the time pass.

And each time pass more time and it becames harder. So, my question is:

What was your early motivations to not spend time on other things beside coding?

I like it, I want to improve, but I'm a little shit without ideas or goals, so is hard to me to get used to code daily beside the fact it doesn't tire me.

Thanks in advance and sorry for my english.
>>
>>55134431
its pointless.
its just 0[some_address] which is no different then some_address[0]
>>
>>55134670
but if you're writing your own OS you will need to access fixed locations

>>55134703
but you'd need to cast to a pointer
>>
>>55134476

If you're going to use MMIO, it's more intuitive to have a pointer to the first element in it and treat it like an array, rather than your weird idea of offsetting NULL.
>>
>>55134773
 a[b] == *(a + b) == *(b + a) == b[a]

all the same thing
>>
>>55134682
at first i just kind of pushed myself really hard thinking that if i learned everything quickly id be able to make all these huge projects soon. obviously that wasn't the case but i did pick up a lot along the way. try to come up with projects to make (maybe small games or things like that) to challenge you and keep working. it's okay for you to get bored and move on, just try a different project if that happens or take a small break. if programming starts to get boring you're often better off taking a break than forcing yourself to work really hard and missing out on the fun parts of it
>>
>>55134782
the idea is you treat all addressable memory as an array

in C++ you could do this, too
template <typename T>
T* const mem = 0;

>>55134789
Yeah, but you'd need to cast b to a pointer to dereference b (a is 0 in this case)
>>
>>55131960
bump
>>
>>55134789
is it preferable to use &a[b] or a+b when passing array pointers directly?
>>
>>55131960
this might help
http://fabiensanglard.net/doomIphone/doomClassicRenderer.php
>>
>>55134195
money can't buy life.
>>
>>55134852
depends where you live

>>55134048
use a functional language instead
js is not functional and ignore the javascriptkiddies who tell you it is
>>
File: httpwebrequest.png (42 KB, 927x608) Image search: [Google]
httpwebrequest.png
42 KB, 927x608
Not sure if this belongs in the stupid questions thread.

I'm trying to use WebRequests in C# to essentially click a button on a retrieved webpage to get past the over18? page.

Never tried this stuff before and am learning as i go. What am i doing wrong here?

It just comes back with the same page asking if its over 18
>>
>>55134522
That subscript array operation is well defined, since it is just pointer arithmetic. Since it's using a data type one byte long, the subscript will have the same effect as dereferencing that address. It's not magic or even architecture dependent.
>>
>>55134195
>The C++ was very efficient from what I remember.
WOW WAS I COMPLETELY WRONG! This code is massive!
Anyone know if I should waste time trying to get the 20 year old C++ code working to convert it to JS, or just give up on it? It's 780 lines, including a big pile of obsolete ASM code. I don't know how to get graphics running on a web-hosted site like codepad. Searching for graphics libraries, I don't even know how to search for "C++". "CPP"?
>>
>>55131326
Programming n00b here with very little training in only Java and HTML looking to get much better. Any ideas on resources or ideas that I could use?
>>
>>55134910
>WebRequest, ASCIIEncoding, Stream, Console, StreamReader
sure is OOP in here

>>55134919
780 lines is not much
C++ or CPP is generally fine
>>
>>55134910
Just set a cookie.
>>
>>55134919
SDL2 and WebGL are well supported on emscripten for drawing in an HTML canvas. It's not necessarily easy, but SDL has some pretty tame drawing calls.
>>
>>55134558
>>55134914
http://blog.regehr.org/archives/213
>>
I want to into microcontrollers but don't know where to start. Is arduino a good start?

>>55134919
>"C++". "CPP"?
cpp is usually the better for searching for c++.
>>
>>55134982
but is it supported on a website like codepad.org? or do I need to set up a compiler? ... maybe I should go back to web coding so I can keep the sandbox operating instead of struggling to set things up while sleep-deprived. I just got enthusiastic. you know how you get when it's "time" to go to sleep and suddenly your brain is like "oh NOW I want to get into gear!"
>>
>>55135082
JavaScript runs on the client-side, meaning in your browser, website doesn't need to "support" anything as long as you use any modern web browser. Just create a simple HTML document with your favorite text editor and open it with your web browser. Don't need for codepad or anything like that.
>>
>>55135098
I know about JS. No, I mean does codepad.org support graphics for C++ files on it?
>>
>>55135138
>does codepad.org support graphics for C++ files on it
bro what the fuck are you even saying
>>
>>55134827
a step in the right direction, thank you, but not quite what i'm looking for.

I decided to check R_DrawColumn(), and I see colfunc() points to it, but I still don't see how things are passed to it and how things are applied to SDL.
>>
>>55135366
I mean codepad says that it runs the CPP files hosted on the site, but can it do that with CPP that uses graphics libraries or not?
Since fixing my CPP {in order to convert it to JS} would be such a huge job, I'm just working on the JS version instead.
>>
>>55135572
why cant you compile it yourself.
>>
>>55134682
you git good by gitting good and not being a lazy uninspired shit
work harder, work smarter
>>
>tfw can't work on programming because I have to memorize proofs
>>
>>55134910
oh I know how to do this

a better question, though, is why are you using C# for web scraping?

import urllib.request as urllib2
import os
import requests

with requests.Session() as c:

#GETTING FIRST URL
url='https://www.reddit.com/over18?dest=https%3A%2F%2Fwww.reddit.com%2Fr%2Fnsfw%2Frandom'
headers='Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.107 Safari/537.36'

out = c.get(url, headers={'User-Agent':headers})

html=out.content
soup=BeautifulSoup(html,'html.parser')

print(soup.html.head.title.text)

#WRITING RESPONSE FROM FIRST URL TO FILE
f=open('out.html','w+')
f.write(str(html))
f.close

#CREATING DICT OF INFORMATION TO SEND TO URL
over18='yes'
login_data=dict(over18=over18)

#SENDING DICT TO URL IN FORM OF POST MESSAGE
c.post(url, data=login_data, headers={'Referer':url, 'User-Agent':headers})

#GETTING NEW URL NOW THAT WE ARE 'LOGGED IN'
new_url='https://www.reddit.com/r/nsfw/random'
out=c.get(new_url, headers={'Referer':url, 'User-Agent':headers})

html=out.content

#WRITING RESPONSE FROM SECOND URL TO FILE
f=open('done.html','w+')
f.write(str(html)) #open this up in your browser
f.close


I have no idea why anyone would EVER want to use C# for scraping
>>
>>55135599
Bad experiences ages ago with compilers and libraries. I think things were starting to change last I was doing things 20 years ago so maybe it's not so bad... I remember CYGWIN or something was hell for a while.
>>
I just wrote a Russian Roulette with C#. That's how much I know about programming. I have a couple of books lined up but I'm tired of reading textbooks and watching tutorials. I want to practice. What do?
>>
>>55134431
That is how things were done back in the early days of computing. Well, almost.

For example, 20 years ago in 16-bit code under DOS, you could write

char *vga=(char*)0xB8000;


and then you'd just write data through 'vga' pointer and magically it appeared on the screen.

But that was back then. There was no memory protection. Any program (assuming you were running more than one program at a time) could read and write any other program's memory, leading to all sorts of trouble. Modern systems enforce memory protection and 32/64-bit systems won't let you just willy-nilly read/write any address.
>>
>>55135637
its part of a command for a Discord bot i'm working on, in C# because https://github.com/RogueException/Discord.Net

I only know C++ and this was the closest thing that i'm semi comfortable with.

Thanks for your reply, i did manage to get it working with >>55134946 's suggestion.
I'm learning this as i go and didn't think to use cookies.
>>
Testing to see if I'm banned. I posted a snapshot of some 90s MLP cartoon that I used to watch as a kid and mods reacted unproportionately.

Anyways, let me reiterate. I need to practice programming but I'm all out of ideas. I just wrote a Russian Roulette with C#. How does one write a Tetris using Monogame?
>>
>>55135708
posting pony is explicitly banned because bronies happened
>>
>>55135634
write your proofs in a proof assistant
>>
>>55135708
4chan.org/banned to check if you're banned
>>
File: tutin putin.png (738 KB, 646x720) Image search: [Google]
tutin putin.png
738 KB, 646x720
>applying for job as a full-stack dev for a small company
>initial interview goes well
>now interviewing with the primary software devs
>SQL, javascript , C#/Node.js, HTML, CSS languages required
>mfw I'm scared shitless

what are some questions I should expect in a small company type of interview? I have done C#, SQL, HTML, CSS and a very small amount of javascript and am scared I will fuck up royal in the interview.

What are some core shit in C# and javascript I should know for interviews?
>>
What languages should I learn /g/ to become an independent programmer/consultant? Would anything in particular match well with my current skill set? I'm a CPA with about three years experience in various accounting roles. Thing is I don't know if accounting is for me. Just lost my last job, and been job hopping for quite a while.
>>
>>55135728
Yeah it sucks. Growing up as a kid in a third world country, dubbed American cartoons was my only vice. MLP, that bus that got small and went into people's nose, Arthur, uh the memories.

>>55135759
Thanks for the tip.
>>
>>55135803
Dude. Machine Programming student here. You must go to college. At least community college.
>>
>>55135823
I already have a bachelor's degree in accounting. I'm not going back to school.
>>
>>55135835
That's why I dropped out of English literature. God what a garbage degree. I'm 23 now but I think I can get my Associate's before I turn 26.
>>
>>55135858
Did you finish the English degree?
>>
File: 1432210964126.jpg (106 KB, 579x819) Image search: [Google]
1432210964126.jpg
106 KB, 579x819
anyone uses opengl here?

do you know how to make texture blend with itself within the same draw call? right now if i draw two intersecting textured polygons, and then try to sample texture where they intersect glsl just gives me the value from the last poly.
>>
Anyone know any convenient formulas for division in modular arithmetic (mod a prime)
>>
>>55135876
No. I had no use for it.
>>
>>55131359
I like it. It's basically a cleaner version of Java. If you have to develop on wangblows there's no better option IMO.
>>
>>55135963
Oh okay. Best of luck. Fucking economy is so shit.
>>
>>55135978
I just started programming, I've chosen C# to learn.

Unlike Java

+Clearn, powerful IDE
+More preprioty classes
+NuGet Package Manager

etc.

>>55135987
Thanks man.
>>
>>55135676
https://github.com/Rapptz/discord.py
>>
>>55134558
>C is a high level language
it's not the 70's anymore gramps
>>
>>55135708
How does one write tetris using monogame? That's like... a really specific thing to explain. How do you run an 8 minute mile on the Champs-Élysées? What amount of water does a typical cat contain? The only people who know the answer would be those who just squeezed the cat and figured it out for themselves.
>>
>>55134806
template <typename T>
T* const mem = 0;

(int) mem<int>(0x1000) == 0x4000

WOW it sucks!
>>
>>55135881
>not sure if I understood you correctly

The color buffer can only store one value, so if you want multiple values, you have to do multiple drawcalls and sample the pixel after each.

There is a technique for order-independent transparency that uses a fragment shader to create a linked list of color values in each pixel, then sorts the values to determine the final color. I don't know the exact details, but maybe you could try implementing something like that?
>>
>>55136195
?

1) function call operator is not defined for const pointer
2) Why cast to int? It's already defined to dereference to an int

1000 -> 4000
Yeah that's the point, 0x4000 is where the (0x1000)th int begins
>>
>>55136249
I meant [], typo...
Yeah but memory isn't laid out as a bunch of ints, why would you want to pretend it is?
>>
>>55136284
Well that wouldn't really be useful for fixed memory addresses or for other things

Perhaps for printing or modifying memory, like cheat engine or something
>>
Best IDE for Python? I want something similiar to Visual Studio.

Currently working in Ubuntu.
>>
>>55136356
Visual Studio
>>
>>55136390
Code is meh.
>>
>>55136356
PyCharm.
>>
File: image.jpg (46 KB, 500x375) Image search: [Google]
image.jpg
46 KB, 500x375
>>55133252
Write a GameBoy or SNES emulator anon. They're good projects because they're big enough that they'll take you a while and you'll touch upon graphics and audio at some point, but they're not too big to finish (aside from trying to shoot for 100% emulation accuracy).

You also get to learn some neat stuff about how older hardware worked, for example neat tricks like memory paging.
>>
>>55136195

Here's how you do it:

template <typename T>
class MMIO {
T *ptr;
public:
MMIO(uintptr_t addr) { ptr = (T*) addr; }
T& operator* () { return *ptr; }
T* operator-> () { return ptr; }
const T& operator[](size_t idx) const { return T[idx]; }
T& operator[](size_t idx) { return T[idx]; }
MMIO<T>& operator++() { ptr++; return *this; }
MMIO<T> operator++(int) { auto tmp = *this; ptr++; return tmp; }
MMIO<T>& operator--() { ptr--; return *this; }
MMIO<T> operator--(int) { auto tmp = *this; ptr--; return tmp; }
};

void print(const char *str, uint8_t color)
{
uint16_t word = ((uint16_t) color) << 8;
MMIO<uint16_t> vga(0xB8000);
while (*str) {
word += *str;
*vga++ = word;
word &= 0xFF00;
}
}


Disclaimer: untested
>>
>>55135666
That reminds me of this cool explanation of protection rings and operating systems I was reading the other day.

https://programmers.stackexchange.com/questions/247183/why-is-software-os-specific
>>
>>55135666
if you know what you're doing you can still read and write to any other processes memory
>>
>>55136429
Pycharm is proprietary software that requires you to agree to non-free Terms of Use.
>>
Anyone know where I can get a compiler (and preferably also an IDE) for Zombie?

I'd like to try it out in my free time. The language I'm referring to is apparently this:
http://www.dangermouse.net/esoteric/zombie.html

I think it'd be fun to learn to program like a necromancer:
Zombie1 is a zombie
summon
remember 1
bind

Zombie2 is a zombie
summon
remember 1
bind

FibonacciZombie is a zombie
summon
remember 0
task SayFibonaccis
shamble
say moan Zombie1
say moan Zombie2
remember Zombie1 moan Zombie1 moan Zombie2
remember Zombie2 moan Zombie1 moan Zombie2
remember moan 2
until remembering 100
animate
animate


Also, I'd appreciate a guide. Binging or Googling it returns WAY too many unrelated results.
Also, does it offer OOP-ing?
Or, has this language never been completed?
>>
>>55136356
Geany
>>
>>55136198
actually i was looking for glMultiDrawArrays
>>
>>55136788
No? No one has anything?

Whatever...
>>
>>55136941
Nobody cares about a shitty worded parody language
>muh shakespeare language
>muh trump language

That might be funny for a 12 year old, but 4chan is 18+
>>
>>55136965
I'm a 22½ no-life loser faggot, likely to become a wizard. Handholdless, kissless fucking sorcer-virgin.

I think I've made my point.
Fuck it, though. I'll try to make something based on it.
>>
>>55132538
Might be a bad idea, but my guess would be to use binary in some way.
>>
>>55132538
n ^ (n << 1)
>>
>>55137086
wait

n ^ ((n << 1) | n)

o.w last digit will stay the same
>>
File: Untitled.png (94 KB, 1281x1044) Image search: [Google]
Untitled.png
94 KB, 1281x1044
from selenium import webdriver

browser = webdriver.Firefox()
browser.get('http://google.com')


Why doesn't this work? Firefox opens quickly then "stops working". Somebody said I might need to downgrade to a different FF version.
>>
File: enjoy ur aids.jpg (87 KB, 822x389) Image search: [Google]
enjoy ur aids.jpg
87 KB, 822x389
VS puts telemetry modules into code.
>>
>>55137361
Debug or release?
>>
In SQL
Can someone remind me the proper way to add a value to a field but not by replacing it but by adding the value to it (Int value of course)
>>
>>55137000
At least you got trips.
>>
>>55133308
yes like if you were to print it out it would have random characters that refers to ram.
>>
File: Untitled.png (7 KB, 526x333) Image search: [Google]
Untitled.png
7 KB, 526x333
Guys I need some help. So I have pic related, made in Qt (without designer, only from code)(the language is C++), and I want to update in real time the list. I mean I want to write in species a word, and the list to update automatically, without pressing anything. If I write just "R" in species for example, the list must show Randunica and Rechin. If I put an e, it must show only Rechin. What should I use to do this?
>>
>rational and negative types

Type theory has gone too far
>>
>>55137944
you'll want a string that gets updated every time the text in the box changes, look into event handling.
Here's my dank pseudocode (onInputChanged should be tied to the text editing event)

function onInputChanged()

s = inputbox.getText()
l = s.length()

for element in list
if element.substring(l) != s.substring(l)
listbox.remove(element)
>>
>>55137944
in QT there is a dictionary and autocompletion library ready for use. set your threshold to 1, so it activates on the first keystroke.


I made a webm converter for mac. It's okay, but it would be better if the the console output from the ffmpeg job were piped to the GUI. I can't figure out how to do this though. Anyone wanna try?

https://gitgud.io/berryberry17/webmBroMac
>>
>>55137361
wew lad
>>
>>55137361
>>55137361
>>55137361
volatile indeed
>>
>users who have a copy of VS2015 Update 2 and wish to turn off the telemetry functionality currently being compiled into their code should add “notelemetry.obj” to their linker command line.

>InfoQ reached out to Microsoft to confirm whether or not this default behavior exists in Visual Studio “15” and according to a Microsoft spokesperson while this behavior does currently exist in "15", it will be removed in a future preview release. However, a timetable for removal has not been provided. VS2012 and VS2013 do not include this telemetry behavior.

>…what the code does is trigger an ETW event which, when it’s turned on, will emit timestamps and module loads events. The event data can only be interpreted if a customer gives us symbol information (i.e. PDBs) so this data is only applicable to customers that are actively seeking help from us and are willing to share these PDBs as part of their investigation. We haven’t actually gone through this full exercise with any customers to date though, and we are so far relying on our established approaches to investigate and address potential problems instead.

https://www.infoq.com/news/2016/06/visual-cpp-telemetry
>>
>>55131326
Anime is trash you stupid weaboo fuck
>>
>>55136356
emacs
>>
>>55138426
This guy gets it. Emacs is best text editor and best IDE.
>>
Some guy in a thread about 30 mins ago posted that he'd gotten a homework question

> Hey guys a quick programming question, Java So I need to find the first word (only alphabet letters) in a random string, but I canìt use .next(), and I need to use both .substring() and .indexOf() - or loops because they're in the next chapter.

public class Letters {

public static String parsed = "";

public static void main(String[] args) {

String s = " 2 7_de $ love";

getFirstWord(s, 0);

System.out.println(parsed);

}

public static String getFirstWord(String s, int i){
if (i == s.length()) return s;

String x = s.substring(i, i+1);
char t = x.charAt(0);

if (isAlpha(t, 'a')){
parsed += x;
}
else{
if (parsed.length() > 0) return "";
}

return getFirstWord(s, i+=1);
}

public static boolean isAlpha(char c, char idx){

if ((idx+"").indexOf('z')!=-1){
if ((c+"").indexOf('z')!=-1) return true;
else return false;
}
else {
if ((c+"").indexOf(idx)!=-1) return true;
else return isAlpha(c, idx+=1);
}
}
}



there ya go buddy
>>
>>55134803
Should I try to finish the course from time to time, for example?
>>
Reading the man page for getcwd(char* buf, size_t size) it says that upon success the value returned is the same value that is stored in buf after the function returns, but, for some reason simply writing
getcwd(buf, x);

doesn't change the value in buf, only when I do
buf = getcwd(buf, x);

buf gets a pointer to the string containing the absolute path. I've checked with perror and there seems to be no error when I do the former, but the result is wrong.
>>
how do I convert in assembly 0x0000FF01 in 0x000001FF?
and 0x00BC01FF in 0x00FF01BC?
>>
>>55138543
Is getcwd changing where the buffer points to?
>>
>>55138595
Two loads
Two stores
>>
>>55137384
IIRC it was both debug and release, if you didn't want that, you had to link against some other dynamic library. As far as I recall it was event logger to write system logs about the application runs etc, while it may not seem harmful unto itself, who the fuck knows where these logs are forwarded.
>>
>>55138543
Is the buffer PATH_MAX long? Can you try it with it that large?
>>
Cool
>>
There is a C API I'm working with that demands the volume of the left/right audio channels be specified as a single int stored as:
(left)|(right << 8)

I'd rather not load a bitwise library just to do this operation. Does it have a simple arithmetic equivalent that I can do instead?
>>
gerfags: what was your experience at your uni? which uni?
>>
>>55138740
why you don't want to do bitwise operations?
>>
>>55138740
Would a struct work?
>>
>>55138740
left | ((right * 256) % 256)
Or perhaps
left + ((right * 256) % 256)

% is modulus
>>
>>55136788
Write one.
>>
>>55138698
It would report an error if the path was longer than alloted bytes, also since POSIX 2001 if buf and x are NULL and 0, respectively, then it allocates the space itself. That part of the function works fine if I say buf = getcwd(...);, but not if I don't explicitly assign it to buf.

>>55138615
It should, copied directly from the man page:
>On success, these functions return a pointer to a string containing the pathname of the current working directory. In the case getcwd() and getwd() this is the same value as buf

Maybe my reading comprehension dies off after staring at code for too long, but it looks to me like buf and the return value should be the same after a success.
>>
File: le anime crying emoji.png (797 KB, 812x806) Image search: [Google]
le anime crying emoji.png
797 KB, 812x806
>>55138864
>((right * 256) % 256)
>>
File: 1466254347.png (79 KB, 786x523) Image search: [Google]
1466254347.png
79 KB, 786x523
Python
how do I skip outer loop from the inside loop?
>>
>>55138995
ignore = false
if ...:
ignore = true
if not ignore:
....

kek
>>
Is it a good idea to give someone who has read learncpp.com chapters 1-6 an assignment to parse the output of a program (like ipconfig /displaydns) into a searchable structure?

It shouldn't be too hard should it? No restrictions given.
>>
File: 1466254725.png (88 KB, 667x657) Image search: [Google]
1466254725.png
88 KB, 667x657
>>55138995
ok, I googled it out
seems to work..
>>
>>55132253
One of the major problems with programming. Programming languages fit projects very poorly. Building a program is external to the language, the information needed is often not given directly by a compiler so you have build systems.
The tools to get a nice overview of any specific piece of code generally doesn't exist.

It's terrible.
>systemd
Maybe look at smaller projects first.
Something more sane like https://github.com/nothings/stb
>>
Is there any file manager that intelligently queues file transfers when running them in parallel has overhead?

For example, from local spinning disk to anywhere where the disk is the bottleneck (ie not network), it generally makes more sense to queue rather than transfer in parallel.

Most file managers sorta half-ass it, and queue a set of files/directories you select as a group, but transfer in parallel a second selection, even if it doesn't make sense.
>>
>>55139059
first 6 chapters is just hello world.
>>
>>55139066
Probably doesn't work as you intend.
break just breaks out of the inner loop.
The simplest way is probably to enclose it in a function and return from the inner loop.
>>
>>55139091
>6.15 An introduction to std::array
>6.16 An introduction to std::vector
>6.x Chapter 6 comprehensive quiz
>>
>>55139118
Also it's not entirely accurate to say this guy has just done chapter 1-6. He's ventured outside that so he knows stuff like functions etc.
>>
>>55139105
theres also the else used, that I forgot to use when I first googled it out
then I asked here, went again for googling and checked it out again and noticed that I missed that the whole idea is just if/else
>>
>>55139118
welp, I was checking 0.1 - 0.6. I am an idiot.
Yeah, it should be enough
Thread replies: 255
Thread images: 31

banner
banner
[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.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.