/dpt/ - daily programming thread

Linear algebra edition

Old:

Other urls found in this thread:

learnpythonthehardway.org/book/ex19.html
twitter.com/NSFWRedditImage

first for (((LISP)))

May linked lists rest in peace

daily reminder OOP users

I can't stand your fucking shitty memes.

...

Was there a response to this?

he reported the comment for hate-speech.

Why program when someone else can do it for you? You can't answer this

Why fuck your own ugly gf, when your neighbour can do it for you?

Careful m8, he might be Swedish

idk think quora has removed comments

I need some advise on what I should do to go from NEET to someone who atleast earns some money

In the past 2-3 years, while each year studying something different and dropping out, I've been learning programming on and off on my own. I've learnt C#, python, html and css as well as reading some books concerning programming concepts, but the only project I've ever done with any of these was a C# project. As a result, I currently find myself in what I believe would be between beginner and intermediate, where I'm not clueless but I'm not entirely comfortable (I only feel slightly comfortable with C#).

I also need to start making some money, and the two paths I see are stick with C# and try to find employment, or pick html and css back up and learn all the other stuff to freelance webdev. The issue is how long it would take me to both reach a point where I consider myself employable, and how long until someone employs me.

With C#, I'd become employable far sooner, but I don't know how long until someone would employ me. Webdev on the other hand, would take me far longer to reach an employable point, but finding work/a job would be easier.

I have all the time in the world to go full turbo on whatever path I choose.

What would you personally do or advise me in this situation?

is there a site with similar instructional to new boston, but text instead of vids?

C#, or learn java, do corporate programming(in economics)

You don't need algorithms or other bullshit, simple coding

Get some SQL knowledge and you're primed to do enterprise internal programming, or DBA + Business Intelligence development.

What would be some good projects to show on my portfolio? Just general stuff or should I have something specific in there?

I've looked into this series once, because I'm interested in alternative ways of teaching, but I found it absolutely awful. Sadly it's just one of those cases where a different medium is used for the exact same old routine.

The database book isn't half bad, but it's certainly 'safe', as in, it just has the same information you'd find in any other beginners tutorial.

Does this book actually teach you anything?

You're better off getting your MCSA/MCSD in something.

That alone will guarantee a good starting salary at many places.

I'd gladly take these but as much of a blessing having all the time in the world for something is I sadly don't have a penny

Fuck HTML and CSS. Everything is wrong with it: shit syntax, inflexible etc.
So now I want to create a CLI client and server to manage my files. I was thinking on using Go, HTTP2 and protocol buffers. I looked into RPC, but I couldn't find a good reason to use it over a basic REST API. To start with I want to implement the following commands: GET, LIST, PUT and DELETE. If I feel like it, I'll implement MOVE and RENAME.

The corridor in your house is infested with mice. The corridor length is n. You are given an array a[] of n non-negative numbers describing how many mice there are on a given segment of a corridor. So for some segment i (i has values are between 1 and n) there are a[i] mice on that segment.
There are k (k

What is up with this meme that lisp is jew?

If you read it like a manga, probably not. If you read it like a textbook, you're better off with a textbook.

>hint: use a prefix sum table, s[j] = $\sum_{i=1}^{j} a[i]. If you do, the number of mice on fragment [i, j] will be s[j] - s[i]

You seem to have read some books on databases. Would you recommend?

>*Which would you recommend?

I'm an actual DBA, so I've seen some material.

There really aren't too many great books on databases. It didn't really 'click' until I got my first job and had access to living, breathing data, while being asked to produce meaningful results by managerial staff.

The best thing you can do for yourself is to 'play house'.

Set up an AdventureWorks database. Pick a BI tool. Pretend you're a manager and you want to see particular things grouped and filtered in meaningful ways so that you can tell a story and make business decisions. This teaches you how to query a database.

The next step is architecture. There are plenty of good articles that show you the basic concepts of normalization, indexing, and installation. Build a database from scratch to represent a concept or store idea. The bike shop model is fun, add the ability to rent all items for a little more complexity.

If I can find the book I used in university, I'll post it. Most knowledge was hands-on, though.

>"Well," they say, "look at this function. It is two pages long! None of this stuff belongs in there! I don't know what half of these API calls are for."

>Back to that two page function. Yes, I know, it's just a simple function to display a window, but it has grown little hairs and stuff on it and nobody knows why. Well, I'll tell you why: those are bug fixes. One of them fixes that bug that Nancy had when she tried to install the thing on a computer that didn't have Internet Explorer. Another one fixes that bug that occurs in low memory conditions. Another one fixes that bug that occurred when the file is on a floppy disk and the user yanks out the disk in the middle. That LoadLibrary call is ugly but it makes the code work on old versions of Windows 95.

Does /dpt/ know how to use linked lists?

Yis

Never tried making one, but seems pretty straightforward.

This isn't webdev general. Leave.

>If I can find the book I used in university, I'll post it.
I'd appreciate it.

>It didn't really 'click' until I got my first job and had access to living, breathing data, while being asked to produce meaningful results by managerial staff.
I can see that, as I had a little of the same experience while being an intern. Since then it was always in the back of my head to learn more.

>Set up an AdventureWorks database. Pick a BI tool. Pretend you're a manager and you want to see particular things grouped and filtered in meaningful ways so that you can tell a story and make business decisions. This teaches you how to query a database.
That'd be great, but it seems a little abstract for me atm. I have too little experience to e.g. know what kind of results would be expected from me. Might try it nevertheless.

>The next step is architecture. There are plenty of good articles that show you the basic concepts of normalization, indexing, and installation. Build a database from scratch to represent a concept or store idea. The bike shop model is fun, add the ability to rent all items for a little more complexity.
I had a little of this at my uni, but I'd definitely need to refresh and normalize (hurr durr) my knowledge.

"No."

Nope.

The best way to used liked list is not at all. They're a pathological case for CPU caches and have no advantage over vectors.

was meant for

>no advantage over vectors
you obviously don't know how/when to use linked lists

Does anyone know if there's any way of catching other programs' crashes on Windows/Linux?

Like on Windows for example when a program crashes the process still keeps running because it opens the error reporting window, so you can't just check when the process dies.

Or what about on Linux?

Sup Forums screams at me every time I tell them there's nothing wrong with linked list stacks

valgrind

linked lists are pretty shitty for stacks

I meant I want to make a program that watches other programs for crashes.

How is a program supposed to know that?

That's what I'm asking. I was wondering maybe there could be some OS specific APIs for querying process state or something.

Isn't the whole point of a linked list, that you can insert at O(1) by just swapping a pointer?

Holy shit, I just saw the Apple conference on swift and it's the greatest language of all time. Like, holy shit. It lets you code without the boring nerd shit, how awesome is that?

A 'crash' could be literally anything.

If someone handles an exception, no crash happens (sort of), because the program is functioning as intended.

If you just want to check if a process crashed/stopped responding, use monit. For the more advanced monitoring you need a controlled environment. Try Erlang.

what the fuck is linear about algebra ?
what the fuck is discrete about mathematics ?
...
i had more but forgot them

>insert
no, remove is where it has an edge over vectors

Really, what's the difference between a "crash" and a "hang" where the process stops responding to the OS?

You should focus on more important things, like memory errors, because these lead to wildy unpredictable bugs.

Mind going into a bit more detail, rather than just parroting the slogan?

Sounds dumb

Go check the conference sticky. It's programming made easy. Nerd shit like C is obsolete.

>a non-systems programming language made a systems programming language obsolete
Sure bud

Crash means the process exists with some error. Hang is more ambiguous and harder to detect. In case of a server, you ping it and check the pong.

Thank you for emulating a tape recorder. I am glad to see your brain capacity can handle as much.

Swift is going to change the world. It's going to make coding easy for everyone.

I can't view the stream.
How is it gonna make anything easier?

Drag and drop?

>what is halting problem

Sup /dpt/

Database design fun!

Let's say I have a table named "Image", which represents a single image with a directory link and other data like filesize, width etc...
Now this image has a source. It came from somewhere. Either I got it off pixiv, or some user uploaded it.

How do I best represent this source, and how much splitting of tables is too much? Initially I just added a simple "source" texfield on the image. Works fine, but it doesn't tell me much.

What do you think about something like this:

table image
table image_has_source
table source


Where the image_has_source contains a link/description, and the "source" table functions like an enum of source types. (Pixiv, deviantart, local import from disk, user upload etc...)

What say you /gee/?

Sounds like Java, which led to C# development.

We have enough memes already, so no thanks.

I'm sure bud

>tfw java dev
>tfw looked down upon by "real" programmers

BUT THE STUFF I MAKE HELPS PEOPLE A LOT AND IT MAKES THEM HAPPY:((

A corporate environment is not """""people""""""

>products of java
>making people happy
What kind of hellish nightmare do you live in?

The halting problem does not apply to applefags. No matter what you tell them, the output is always the same.

Haskell strings are linked lists of 32-bit characters, and some people claim it isn't a meme language?

Wait, hold on. So Haskell strings are mutable?

I'm gonna be spending a large chunk of the next year at work porting shit to Android.

However, I am under no illusions as to there being any hope my work is going to truly help end users or make them happy.

Nothing groundbreaking ever happens with Java, just mild improvements to user convenience (at the expense of efficiency).

They wouldn't use a linked list if random access was wanted.
Probably just so you can resize (move the head or tail) very easily, and never have any wasted memory allocated.
Apart from, you know, the whole overhead of using linked lists.

Shit, may as well store every single loop counter in java as an Integer rather than int primitive.

>Shit, may as well store every single loop counter in java as an Integer rather than int primitive.
I saw someone a while back post here that actually did that.

That's not funny user, my brother died that way.

what is programming like?
explain how you feel and how you think when doing it.

>Haskell strings are linked lists of 32-bit characters
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAAHAHAHAHAHAAHHAHAHAHAHAHAHAHAAHAHAHAHAAHAHAHAAHAHAHAHAAHAHAAHAHAHAHAAHAHAHAAHAHAHAAHAHAAHAHAHAAHAHAHAHAAHAHAHAHAHAHA
This is comedy gold!

>any year
>using Hasklel
Top fucking kek.
Why would anyone in their right mind consider Haskell.

There is no excuse.

Holy shit that book is amazing. Are there any other manga books about math or physics?

ayy lmao

it's like most other forms of writing, you're trying to keep that unaltered conscious stream of focused thought going, letting the words appear in front of you and reviewing them. there are interruptions where you must stop, think, and plan ahead, but this is again not uncommon to the writing of fiction or even exposition. we are just scribes of the new age.

There's a whole series by the same publisher.
They're ok primer books.

How dare that faggot attack templeOS. I hope he fucking dies.

>Every time

Any OpenGL nerds here? I desperately need some help, been banging my head against the wall for hours.
I'm trying to render a simple image with lwjgl but it's just showing a white square, as if my texture code is meaningless.


Loading the pixels from PNG:
PNGDecoder pngDec = new PNGDecoder(inStream);
int w = pngDec.getWidth();
int h = pngDec.getHeight();
ByteBuffer buffer = ByteBuffer.allocateDirect(w * h * 4);
pngDec.decode(buffer, w * 4, PNGDecoder.RGBA);
buffer.flip();


Generating openGL texture:
int texID = GL11.glGenTextures();
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texID);
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0,
GL11.GL_RGBA, width, height, 0,
GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, buffer);


Drawing the texture:
GL11.glColor4d(1.f, 1.f, 1.f, 1.f);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texID);
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(0, 0);
GL11.glVertex2f(0, 0);
GL11.glTexCoord2f(1, 0);
GL11.glVertex2f(w, 0);
GL11.glTexCoord2f(1, 1);
GL11.glVertex2f(w, h);
GL11.glTexCoord2f(0, 1);
GL11.glVertex2f(0, h);
GL11.glEnd();
GL11.glDisable(GL11.GL_TEXTURE_2D);


The coordinates are in the right place, in fact all of the other GL drawing I've tried to do works, but the texture won't show up, just a white square. The width and height are registered correctly and I've confirmed that the pixel data is read correctly. Every tutorial says that this is the right way to do it but nothing's working.

looks good for me, but I only have a very basic experience with databases.

Do you evn Data.Text.

How would I post a bit of code on here?

>does the OS have a working networking stack
I think that's quite a loaded question because he is implying that any computer needs to be able to communicate with other computers. My calculator doesn't have a working networking stack and it's doing its work just fine.

Haskell strings are lists, not linked lists

>I think that's quite a loaded question because he is implying that any computer needs to be able to communicate with other computers
where the fuck he implies that

when he asked if the OS has a working networking stack

do you have a wife?

fuck off terry

No?

Alright So I'm learning python "the hard way" and doing exercise 19, I thought I would try to set it up where the user could input their own numbers into the function but I keep getting errors and I can't seem to figure out why.

learnpythonthehardway.org/book/ex19.html

does my question imply you need to have a wife to be a functional human being?

2.7.11 btw

Do your own CS homework

That's easy. The raw_input is a String. You need integers. Do this

p2cheese = int(raw_input())