[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 339
Thread images: 31

File: 20-15-50-maxresdefault.jpg (117KB, 1280x720px) Image search: [Google]
20-15-50-maxresdefault.jpg
117KB, 1280x720px
/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 (766KB, 1278x1202px) Image search: [Google]
1447734883815.jpg
766KB, 1278x1202px
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 (658KB, 2040x3160px) Image search: [Google]
1458807275054.jpg
658KB, 2040x3160px
>>55131411
>How does 4chan do it?
>>
File: lisplogo.png (29KB, 811x805px) Image search: [Google]
lisplogo.png
29KB, 811x805px
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 (25KB, 396x400px) Image search: [Google]
1463696945268.png
25KB, 396x400px
>>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 (60KB, 500x500px) Image search: [Google]
1465406303814.jpg
60KB, 500x500px
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 (48KB, 336x280px) Image search: [Google]
1453303517244.png
48KB, 336x280px
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 (177KB, 600x740px) Image search: [Google]
ceos_gone_wild_by_rware-d3af4f1.jpg
177KB, 600x740px
>>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 (20KB, 400x400px) Image search: [Google]
17429012.png
20KB, 400x400px
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 (21KB, 393x360px) Image search: [Google]
hmmm.jpg
21KB, 393x360px
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 (304KB, 722x768px) Image search: [Google]
nani.png
304KB, 722x768px
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 (68KB, 884x666px) Image search: [Google]
1429581742508.jpg
68KB, 884x666px
>>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 (44KB, 120x187px) Image search: [Google]
output.png
44KB, 120x187px
>>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 (75KB, 1010x860px) Image search: [Google]
hexclock.jpg
75KB, 1010x860px
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 (63KB, 845x506px) Image search: [Google]
235235.jpg
63KB, 845x506px
>>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 (42KB, 927x608px) Image search: [Google]
httpwebrequest.png
42KB, 927x608px
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 (738KB, 646x720px) Image search: [Google]
tutin putin.png
738KB, 646x720px
>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 (106KB, 579x819px) Image search: [Google]
1432210964126.jpg
106KB, 579x819px
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 (46KB, 500x375px) Image search: [Google]
image.jpg
46KB, 500x375px
>>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 (94KB, 1281x1044px) Image search: [Google]
Untitled.png
94KB, 1281x1044px
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 (87KB, 822x389px) Image search: [Google]
enjoy ur aids.jpg
87KB, 822x389px
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 (7KB, 526x333px) Image search: [Google]
Untitled.png
7KB, 526x333px
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 (797KB, 812x806px) Image search: [Google]
le anime crying emoji.png
797KB, 812x806px
>>55138864
>((right * 256) % 256)
>>
File: 1466254347.png (79KB, 786x523px) Image search: [Google]
1466254347.png
79KB, 786x523px
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 (88KB, 667x657px) Image search: [Google]
1466254725.png
88KB, 667x657px
>>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
>>
>>55139137
He has all the tools needed but I'm not sure how familiar he feels with programming.
>>
I'm currently building a automatic mail system on Java.
i.e you send a mail to the system's gmail address, the system moves the mail to a label and sends you a response file.

But the GMail api is shit tier and I'm not sure whether Javamail api can move a mail to different labels. Any recommendations?
>>
>>55139153
>GMail api is shit tier
Think it's looking pretty great. Just browsing the overview/reference lightly.

What issues are you having?
>>
Are programming jobs common?
Other than software engineers that create windows and shit.
>>
>>55139178
yes, very
>>
>>55139178
http://www.statista.com/statistics/203428/total-enterprise-software-revenue-forecast/
There's practically nothing in existence that doesn't have at least a hardware programmer working on it. Usually you have software programmers.
>>
>>55138880
What does buf point to before you feed it into getcwd? Maybe it's null, or x is 0. Show us more code pls.
>>
I like programming, I really do, but I have no idea what to program. I wish I could contribute to something or think of something to make.
>>
>>55138740
>bitwise library
what kind of shit language is this
>>
>>55139177
I too chose Gmail api in the beginning at a quick glance to overview, but they are written in 2013, and there are no updates since then. Also there is a bug related to accessing credentials on Windows rendering you inable to use Gmail Api on java with Windows.

On top of that, there isn't any examples or guides to sending a mail using api. (there are two functions but the parameters arent declared thoroughly)
>>
>>55138740
(pow(2,8)*right)+left
Assuming left is limited to the range 0-255
>>
Starting to learn Python after having learned java. Is there any way to NOT typecast input?

for example

 int(input("How's it going, lol?")) 


Seems retarded to me.
>>
>>55138740
>>55139332
But really what are you doing if you can't figure that out?
>>
Any quick guides to C#?
Coming from C++ and having minor Java experience.
>>
>>55139351
wtf
>>
>>55139303
Probably Go or some shit.
>>
>>55138740
both numbers are unsigned integers
assert(left < 256)
assert(right < 256)
left+256*right
what language are you using? you shouldn't need an extra library for bitwise operations
>>55139059
assuming it's their first assignment
far too complicated, it takes a lot to get into programming, it's more about getting the concept that understanding the syntax of the various features. For example i knew the syntax of pointers but not what they were useful for. I was struggling with returning an array from a function. Much later i learned that you can return as many arguments as necessary using out parameters etc.
if they're into math, try the projecteuler exercises
>>
>>55139332
i think C only has floating-point pow, not sure if it works with that
>>
Need help writing a simple code in Java.
Basically what the code should do is analyze a string and output the first and second word. By word I mean a string of adiacent alphabetic letters.
For example in the string " Hello, my name is Luca ", it shuld return Hello and my.
In the string " Hel!lo" it should return Hel and lo.
The challenge consists in not using nor loops nor if conditions, and the code must include .indexOf() and .substring()
>>
>>55139417
>their
This is a single person I'm tutoring. He's not prone to ask a lot but I'm trying to encourage him to. I'm convinced he could learn quicker if he does. I've given him a skeleton which sets him up in an environment where he just has an inputstream to the program output. So there's just structuring code and parsing for him to do really.
>>55139432
This is intended integer pow. And it's clearly pseudocode. We don't even know his language.

Point in using pow was to not introduce magic numbers. And half-compiler will compile a function call with two constant variables like this to a value.

Now he knows how to shift any amount.
>>
>>55139399
I wouldn't recommend a "quick guide" to it because it offers a lot that C++ doesn't have that are really beneficial to know. I would Google a list of advanced topics, then google those topics. The MSDN pages are pretty good sources.
>>
>>55139480
Just think. I guess if you've been given this assignment, you're able to do it or what? Are you a weakling, Lucas?
>>
>>55139483
>offers a lot that C++ doesn't have
Sounds like stuff I don't want though.

Depending on what it is. But I find C++ bloated already. I'm just doing this because it's required for the project.

But I'm missing things like how I include stuff, how I get a vector (or equivalent) the basic syntax stuff. Polymorphic call rules.
>>
>>55139480
Somebody already did it for you itt, faggot.
>>
>>55139504
Google "using directives" for includes, "System.Collections.Generic," polymorphism, "C# keywords," "C# syntax," etc. anything you need to know literally has an MSDN page so you can google exactly what you need (example: "C# how to pass function as argument" will guaranteed hit the MSDN page on delegates) and you will find it. Not sure if the pages have a general directory though. Alongside a lot of this stuff you'll probably also find a website called dotnetperls, it's decent for a quick rundown on topics (kind of like what you want.) Also try googling "C++ to C# MSDN" because I am pretty sure they got a page for that too.
>>
>>55139521
He specified there's no for or if statements..

Basically now he's asking for a mathematical solution to ascii character recognition.

The solution would be some subtraction of characters and then you pass it to substring() and compare the results using a string compare. Because a negative number call to substring clamps it to 0. So we get a string equivalence. We can probably do something from there. Because we've determined that the character was outside of the desired range.


I'm not doing that shit though. Troll assignments. Doesn't help you be a better programmer in any way. Clearly nobody who goes to that school has any worth. Not even the teachers.
>>
File: tfw.png (463KB, 538x534px) Image search: [Google]
tfw.png
463KB, 538x534px
>F#
>tfw no HTK
>>
>>55139585
>Using obscure hipster languages
>>
>>55139480
While loops? Recursion?
>>
>>55139559
>C++ to C# MSDN
I'l look at that.

Slowing down because you don't know syntax is a pain though. Nobody should be forced to program like that.
>>
>>55139481
as an example, does he know how to do string->number and the other way around? he might try writing his own functions and discover that it's surprisingly hard
>>
>>55139614
He could. But it's not really hard when you don't have any performance constraints.
I'm confident he'd know how to write an atoi.

I'm more worried about how he structures his code for the parsing. He should probably write a function that determines which line he's on and switch on the return of that or something. But I'm not sure he will. And since he won't ask that worries me a lot. I didn't think about giving him that assignment enough.
>>
File: 1466060880106.gif (136KB, 300x300px) Image search: [Google]
1466060880106.gif
136KB, 300x300px
>>55139495
Thought about for a day, except an overly complicated program which I have no intention to put effort and time in, I can't think of an efficient way to solve it.
>>55139601
not allowed to use those
>>
>>55139599
>F#
>obscure hipster language
https://fsharp.tv/gazettes/f-the-most-highly-paid-tech-worldwide-in-2016/
>>
>>55139658
>except an overly complicated program
Explain.
>>
>>55139671
I did not know that, interesting.
>>
>>55139658
indexof(' ')
or something, then substring form 0 to that, and search the next space for the boundaries of the second word. How's that not good enough?
>>
>>55139673
Firstly I would trim the string, then get all sets of characters that are divided by spaces by calling the .next() method as many times as there are single whitespaces. Afterwards I would look into each one of the strings for all characters that aren't letters if there are any, find their index with indexOf(), remove them and separate the word where the non-alphabetic character was.
>>
>>55139480

Obvious troll.

Every time I solve this you come back with the same question minus one programming construct and a host of random missing letters from your posts.

My previous solution was here >>55138490

If I were to solve it again you would no doubt post the same question but with one more thing missing like methods or objects.
>>
>>55133401
Is C# really windows only?
>>
>>55139759
Oh,sorry I didn't see that
I'll take a look at it now, thanks
>>
>>55134522
C is a dangerous language and shouldn't be used anymore
>>
>>55139790
t. rust pro
>>
Been learning Python, going through a couple of books. Feel like I'm starting to learn some...

Almost finished with John Zelle's Python Programming. Haven't mastered it, but I'm starting to pick up.

What step do I take to reach the next level?
>>
>>55132007
Make it a two-stage process with the neural networks generating Markov chain which are then used to generate music.
>>
>>55139823
Markov chains*
>>
Why are loops in python so retarded?

 for (int i = 0; i < length.str; i++)
System.out.println(str[i])


How do I make that loop in Python?
>>
>>55139813
C is the equivalent of having a car with just a gas peddle, no brakes (gotta go sanic fast) and no safety features like seatbelts because only n00bs need it. A pro driver will never get into a car accident.
>>
Behold
curl http://badapple-errio.rhcloud.com/
>>
>>55139836
something like
for i in str do print(i)
>>
>>55139836
>
int i; i < len; i++

actually THIS is retarded, it's way less abstracted.

for char in str:
print(char)

or
for i in range(len(str)):
print(str[i])
if you're like that.
>>
>>55139759
>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);
> }
> }
>}
It works, but I said no conditions
>>
>>55139883
use [code [\code brackets
] ]
>>
>>55139854
Cool
>>
>>55139846
>safety
meme of the year
>>
>>55139883

I'm fairly sure that the subset of java not containing conditionals would be stretching the definition of 'turing complete'
>>
>>55139913
Enjoying your exploits like shell shock thanks to C?
>>
>>55139881
show $ concat $ intercalate "\n" str
>>
>>55139926
whoops

print $ intercalate "\n" str
>>
New thread when?
>>
New thread:
>>55139968
>>55139968
>>55139968
>>
>>55139926
>>55139940
In any case you're off-topic.
>>
>>55139881
>actually THIS is retarded, it's way less abstracted.
That loop comes from LISP.

The traditional for loop resembles
for i = 1 to n
.
>>
>>55139854
my eyes hurt now from all the flickering but that was fucking awesome
>>
>>55139399
It is pretty much java except that there are struct s that can be passed as value
>>
>>55140054
That's hardly a loop, that's 3 separate instruction which you're supposed to know are the idiom for an increasing loop. Actually, they are a bunch of repetitive and arbitrary characters that you can't abstract away. (well a macro in C, but nothing in Java.) And lisp has dotimes, or an abstractful for at least.
>>
>>55140079
Yeah, I have no idea about how to reduce the flickering. Which terminal are you using? From the few I have tested terminator seems to handle it a bit better.
>>
>>55140111
urxvt-unicode, but I just tried it with lxterminal which was smooth for the most part (only occasional short flicker sometimes)
>>
>>55140107
>that's 3 separate instruction which you're supposed to know are the idiom for an increasing loop
Does this look familiar?

http://www.lispworks.com/documentation/lw60/CLHS/Body/m_do_do.htm
>>
>>55140136
also tried it with gnome-terminal and xfce4-terminal which were alright, I guess it's mostly urxvt for some reason
>>
>>55140201
Yes, except it's not the standard way of looping in CL, and any language besides C-like cancer. You loose.
>>
Anyway to make this code more efficient? Did I add any redundant lines of code?

"""Calculates the digital root of a number. Muh 999"""

def DigitalRoot(number):
total = 0
for digit in number:
number_digit = int(digit)
total = total + number_digit
string_total = str(total)
if len(string_total) > 1:
DigitalRoot(string_total)
else:
print(string_total)

number = input("Enter the number you want to find the digital root of.\n")
DigitalRoot(number)
>>
>>55140266
That loop came into C from LISP.

BCPL used a loop like
for i = 1 to n do ...
.
>>
>>55140312
Modern C kept it, java javascript and others adopted it, whereas no one writes a range-loop like that in lisp.

Also BCPL is pure English-like grammar Algol garblage. The do loop is more flexible than its high-level counterparts, but it's lower-level and error prone.
>>
>>55140285
Do you care about efficiency or verbosity? I'm not sure. Either way why convert to string and get the string length instead of simply checking if the total is greater than 9?
>>
>>55140285
Actually when looking over this and googling around, I found another way to check the digit of an int without converting to a string. Something like this

 counter = 1
while number % 10 doesn't equal 0
remainder = number % 10
number - remainder * 10^counter
counter = counter + 1


No idea how to code that. Would that be a better way of doing that?
>>
>>55140359
>whereas no one writes a range-loop like that in lisp.
No one writes it like that in Lisp anymore, but they did around the time of MacLisp.
http://www.maclisp.info/pitmanual/contro.html

>Also BCPL is pure English-like grammar Algol garblage.
That kind of loop was intended to be the same as the primitive recursive functions. The C/Lisp loop doesn't have that property.
https://en.wikipedia.org/wiki/BlooP_and_FlooP
>>
>>55140409
verbosity, want to make things easy to read and least amount of lines possible
>>
>>55140409
>Either way why convert to string and get the string length instead of simply checking if the total is greater than 9?

Takes string as an input so that's the only way to recursively call the method until there are is only one digit. This is why I posted

>>55140430

Which is a method to get the digits of an int without converting to string.
>>
>>55140442
>No one writes it like that in Lisp anymore, but they did around the time of MacLisp.
I'm not saying no one ever did. Agreed

>That kind of loop was intended to be the same as the primitive recursive functions.
Didn't know that, but it makes sense now. My point still stands tho: it should be abstracted away because functional programming and whatnot.
>>
>>55140430
woops this doesn't work. I have to get rid of the last digit, not set it to 0. Which I have no idea how to do. Oh well.
>>
>>55139817
Develop a personal project.
>>
>>55139913
>>55139846

The funny thing is usually things like watchdog timers and hardware safety features are done in C
Thread posts: 339
Thread images: 31


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.