[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: Big Mac Edition

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: 321
Thread images: 47

File: mcdouble.jpg (162KB, 1536x1129px) Image search: [Google]
mcdouble.jpg
162KB, 1536x1129px
Previous Thread: >>57478870

What are you working on, /g/??
>>
first for Smalltalk
>>
Procedurally generated hamburger for a demo.
>>
File: 200[1].jpg (8KB, 200x200px) Image search: [Google]
200[1].jpg
8KB, 200x200px
>>57499525
>big mac
>it's a mcdouble
>>
>>57499525
>>57499581
mcdouble so cute!!
>>
what programming language would be used by the president elect of the united states of america?
>>
>>57499525
That's not a fucking big mac, OP.
>>
>>57499581
this
>>
File: Lenna.png (463KB, 512x512px) Image search: [Google]
Lenna.png
463KB, 512x512px
Fucking around with OpenCV.
>>
>>57499593
Perl
>>
>>57499604
What problem are you trying to solve?
>>
>>57499621
this
>>
>>57499593
Anything with a random function that's poorly implemented is fine.
>>
>>57499604
I'm reading tutorial about C++ to fuck around with OpenCV.
I'm interested in Optical Flow, what are you doing?
>>
What is the logic behind putting something in the WindowProc vs. the message loop when doing Win32 programming?
>>
>>57499656
Right now I'm really just learning the basics.

The end goal is detecting board state from photograph of a game (for Checkers, Chess and Settlers of Catan) that will be linked to existing library for best play suggestion.
>>
are there any implementations of an untyped lambda calculus into a programming language? how do you deal with the lack of explicit types in practice?
>>
>>57499707
If you want to interrupt one of the normal ways windows handle things you can do that in WindowProc by simply not calling defwindowproc for that specific message while you handle it yourself in WindowProc. For example if you don't do the defwindowproc in WindowProc for WM_SIZE it won't be resizable. But you can do something else based on those messages.
Would be annoying as fuck but it's an option.

For 99% of applications you use the defwindowproc for almost everything.
>>
https://twitter.com/noopkat/status/797831177902104576

rate my codefu
>>
>>57499877
>judge this person for me

Well she does open source. A rarity, +1 point.
She has some rice on her stream (temprature of something). +1 point.
She does JS -1000 points

Go to /wdg/
>>
anyone care to help autist write his program?
i've been trying to write a *booru crawler in C but it's 3rd day and i still have no idea what the fuck am i doing
i looked through documentations and examples but it's all for nothing because it's all written for people who are into it already
let's take pic related for example. like, i don't even...where is that variable?
>>
File: output.png (68KB, 1200x1350px) Image search: [Google]
output.png
68KB, 1200x1350px
I did a simple program that converts images to black/white with dithering.
>>
File: wut.png (25KB, 679x799px) Image search: [Google]
wut.png
25KB, 679x799px
>>57499928
and i forgot pic
>>
>>57499933
What dithering did you use?
>>
>>57499943
>where is "that variable"
I don't see anything strange. Aside from possibly the fact that you don't assume the CAPITAL_IDENTIFIER to be a macro definition.

I don't know curl but it looks to me like you're implementing your entire program in the callback essentially.

Open a debugger with inspection and read the pointer you get. See what it is.
>>
could anyone help me? I've been banging my head at this function for a while trying to understand why it's giving me a segmentation error but i can't find it.

This function adds a person in the paramater to a List node which gets added to a Linked List. The array hashtable[25] is an array of linked lists

the function hash returns a number between 1 and 26 so hash()-1 returns 0-25

void HashTable::addToTable(string name, Person* p) {
int position = hash(name)-1;
ListNode* node = new ListNode;
node->setData(p);
hashtable[position]->instertNode(node);
}
>>
>>57500032
>why it's giving me a segmentation error but i can't find it.
Usually they tell you a line number.
I assume you mean it's the last line. Worth considering the instertNode (typo of insertNode I assume) function. Post that too.

Also use a debugger.
>>
>>57500032
An index of 25 requires the array to be at least 26 elements long.
>>
>>57500074
they didn't tell me a line number
I somehow managed to mistype insert 3 times so it wasn't that either
ill go use a debugger

>>57500085
i just removed the 25 from it's initalization and its still giving me a segmentation fault
>>
>>57500016
to use a debugger, i would have to make a project and other headaches. will a few printf() here and there be sufficient?
>>
>>57500155
Sure put printf's everywhere. But it's really convenient to have a debugger. So you can walk through the program and see the errors happen.
It's just easier.
But you can print every variable in the run and what function you're in. Should be very similar but it's a lot of typing.

Platform/IDE/compiler?
>>
>>57499948
I used my own method of dithering which I came up with through trial and error. It uses the sine function.

This is the code: http://pastebin.com/SiMsvz9c
>>
>>57500178
at first it is:
¸ě←└¸ěYH]├ÉÉÉÉÉj►hp\ývŔ_<˙3WŔjH˙Yë}Ř9u∟żx1v5x1vŔ|e˙ëEńăEÓ
then it's nothing
formatting it gives me random numbers

winshit/code::blocks/gcc
>>
>>57500367
I think it's set up by default. Set a breakpoint and press the debug button (red arrow not green arrow).
Press Step over line and watch variables until you crash.
>>
Going through TCPL SE exercises.
>>
having trouble with wrapping my head around networking with boost asio because im an idiot
can anyone recommend a tiny crossplatform socket wrapper for C++?
>>
>>57500388
Sorry I confused your two posts.
Have you read the documentation?
Also this is probably a better example to use than some random person who didn't even get it at first.
https://curl.haxx.se/libcurl/c/getinmemory.html
>>57500436
SDL_net
>>
>>57500458
>Have you read the documentation?
>>57499928
>i looked through documentations and examples
yes, this entire site thoroughly as well. still no luck
>>
>>57500458
>depends on SDL
>lightweight
>>
>>57500243
Thanks anon
>>
>>57500578
Oh you were thinking you were just gonna copy and paste everything? I thought you wanted something to work with.

Well fuck you do your own googling you little shit.
>>
File: 1400380655998.png (127KB, 257x250px) Image search: [Google]
1400380655998.png
127KB, 257x250px
>>57500606
>>
>>57499581
Ameriburger spotted.
>>
>>57500606
>t. SDL_net dev
>>
>>57500656
No. Just for the record.
>>
File: 1372422687417.jpg (103KB, 1280x720px) Image search: [Google]
1372422687417.jpg
103KB, 1280x720px
how do i know if i'm good enough to be a hacker?
>>
>>57500680
see if you can manage to post nothing but anime on /g/ for 3 weeks and you will know.
>>
>>57499525
Has anybody here used Tensorflow for things other than neural networks?
>>
>>57501255
I've used it to flow tensors.
>>
Assume you have a sequence of n values. You have to find a range in this sequence such that its arithmetic mean is the smallest (the range has at least one element, and n at most).
Can this be done in less than O(n)?
>>
>>57501301
>O(n)
I meant O(n^2)
>>
I'm starting to learn my first programming language (c++), should I use code::bocks or pirate visual studio?
>>
>>57501418
code::bocks is more than enough
>>
>>57501418
>visual studio
it's available for free

code::blocks is literally retarded
>>
>>57501418
Why not qtcreator?
It is free, automatically pauses terminal applications and is very useful when you want to add interfaces for your stuff
>>
File: JUST.jpg (27KB, 600x424px) Image search: [Google]
JUST.jpg
27KB, 600x424px
>mfw studying for the Java 8 certificate
>>
>>57501418
CLion
>>
>>57501443
>Retarded
Why?
>>
>>57501418
vim & GCC
>>
>>57501318
>>57501301
Yes
You will have to carry a lot of data in each iteration though, as monotony is not given.

If you are allowed to Sort it beforehand you can actually do it without needing more data(adding another single iteration dosent change the class it is in as asymptotical behavior is the same).
>>
>>57501460
OCA or OCP?
>>
>>57501538
this or get replaced by ranjid.
>>
>>57501532
It's like a program from the 80s
>>
>>57501551

OCA, I think that's the first step.
>>
>>57501561
he asked why it's retarded not why it's awesome
>>
>>57501601
It's not awesome though
>>
>>57501418
Install any linux distro, emacs and use cmake/make
>>
currently working on Seinfeld themed small projects with a buddy.
thefeldproj.servebeer.com
>>
>>57501550
Nope. He just needs to find the smallest value of the sequence in O(n). Can be easily proven that anything other than the smallest number is greater.
>>
>>57500134
We need to see your setData() function..

Also, where's the hashtable[] being initialized?

Errr... I think it's because you didn't call the constructor to your new ListNode() and so you're calling from a null object.
>>
Nee help on installing Pygame ?
I just installed Anaconda with the Spyder IDE and I have no idea how or where to install Pygame ?
I'm not familiar with Python at all.
>>
>>57499525
ASKED IN SQT WITH NO LUCK
ok so facebook chat (messenger and the regular website) cause mini 2 second freezes in my browser, I'm wodering if a CLI or lightweight facebook chat client exists only problem I could imagine is I put my laptop to sleep by closing the lid not sure if that would cause issues but I'd imagine software that trys to auto reconnect after loss of connection would be good
>>
So I have this question I'm doing right now:
Write a function, firstLetterWordCountDict(), that reads 'wordlist.txt' containing a large set of words (one per line), and returns a dictionary D with keys equal to the lowercase letters ('a', 'b', 'c', ... , 'z') and values equal to the number of occurrences corresponding to each letter in all words combined.

I currently have this:
def firstLetterWordCountDict():
elfile = open('wordlist.txt', 'r')
D = {}
key = 0
for word in elfile:
for i in range(97, 123):
if word.startswith(chr(i)):
key += 1
D.update({chr(i):key})


It does add up the 'a' key correctly but obviously I'm not resetting the key correctly. Anytime I try to restart the key to 0 it'll just output all letters as 1. What am I doing wrong?
>>
File: ctf.jpg (48KB, 600x600px) Image search: [Google]
ctf.jpg
48KB, 600x600px
>>57501582
enthuware.com

Their "sample tests" are legit. You still need to understand principle of the questions so you can't just straight up memorize everything, but it should help you with preparation considerably. If you can pass sample tests with 80%+ you should be able to easily pass the exam proper.

If you already know Java and are not of below average intellect, you can essentially get ready over a weekend with the sample tests.

If you start by getting into Java with the OCA, expect to take around two weeks for get ready.
>>
>>57502261

Thanks, famicom.
>>
>>57500243
what on earth is this language
>>
>>57502534
BBC BASIC
>>
>wake up
>start coding
>check catalog
>never come back to code
>>
>>57502207
>ASKED IN SQT WITH NO LUCK
So?
Your question has nothing to do with programming, your stupid fuck.
>facebook
I think you should leave.
>>
>>57502105
forgot to ask,
How is the code looking? Any tips are appreciated
>>
Sigh... Should've realized sooner that even though I like programming, I just HATE doing it everyday. I should've gone teaching math when I still had that option on my horizon.
>>
I need some advice /dpt/. I have a path-finding assignment where I must draw a path from start position to end position (if possible) in a map. The only data structure I can use is a Queue.

I am also given a general algorithm:
 Do this once at the beginning:
-create an empty Container of cells to explore
-add the start cell to the Container
Do this each subsequent step:
-Container empty? If yes, report "NO PATHS" and end program
-Take a cell out of Container
-Has this cell already been recorded? If yes, then we've already
explored from this cell, so skip the rest of this step and
continue with the next step.
-Is this cell the end cell? If so, we've found a path, so
print it and end program.
-The cell is a not-previously-explored, non-end cell that is
reachable from the start cell. Explore it as follows:
-identify all appropriate adjacent cells in M
-add these identified cells to the Container
-Record that this cell has been explored (so it won't be explored
again).

In my first attempt I implemented a Depth First search (with a Queue). My question is :Does this algorithm fit the description of breadth first search? When trying to implement breadth first search, I could not come up with anything,using just this description. I had to look online before I could write something that worked. Is this algorithm incomplete?

Pic related
Its output of my path finder.
>>
>>57502224
Yup. The only thing it's doing with key that changes it is
key = 0
key += 1
key += 1
key += 1
# and lots of it

You want
key = D.get(chr(i), 0)
#and only then
key += 1
D.update ({chr(i): key})
>>
>>57502921
but then you'd hate teaching math everyday
>>
We have to implement our own shell in my systems programming class; how does this look you guys?
>>
>>57503113
is this a joke
>>
Employed Haskell programmer reporting in
>>
>>57503113
This is shit in so many ways.
>>
>>57502948
This is the A* algorithm if I'm reading correctly
>>
>>57503006
I love math, but I'm not as passionate about teaching. I don't dislike it - let's say, I'm reasonably interested in it. Overall, I think I'd have a healthy distance towards it as a job. I've been tutoring some kids in the past and managed to yield results while not stressing over failures. I miss that distance, when I didn't have to give valid results in x hours.
>>
>>57503121
the benefit is that it can be either bash or batch or powershell depending on what platform you're on
>>
>>57503113
enterprise quality code, mate
>>
>>57503113
rate my compiler /g/

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
if (argc < 2)
return 1;

char compiler[128];
snprintf(compiler, sizeof(compiler), "gcc %s", argv[1]);
system(compiler);

return 0;
}
>>
>>57503121
Are you autistic?
>>
>>57503209
>128 character limit
>>
File: 1474219795830.jpg (5KB, 225x224px) Image search: [Google]
1474219795830.jpg
5KB, 225x224px
>>57503113
>malloc(50)
>>
>>57499525
Thanks for using an anime image
>>
>>57503257
you wouldn't sizeof(char)
nigger
>>
File: 1474219799870.jpg (59KB, 896x921px) Image search: [Google]
1474219799870.jpg
59KB, 896x921px
>>57503281
>>
>>57503281
Did you just assume the size of my char?
>>
>>57503292
your mom's so fat sizeof returns a float
>>
>>57503297
Your mom's so fat dividing by her returns 0
>>
Anyone has any idea on how I should install pygame on Netbeans ?
>>
>>57503311
that doesn't make any sense
>>
Any big /g/uys programming in scala?
>>
>>57503330
Scala is only used by higher-caste pajeets
>>
>>57503320
With IEEE754, Infinity is a value and dividing by it returns 0.
>>
>>57503320
she weighs a lot so it's bigger than any other number and the result of dividing by it gets truncated to 0
>>
>>57503311
your mom is so fat the size of her pointer returns null
>>
>>57503339
>>57503342
that joke is NOT PORTABLE
>>
>>57503353
You're mom's so fat she's not portable

>>57503349
You are moms' so fat she doesn't fit in RAM
>>
How do I check if an index of an array is empty in c++?

for(i=0; i<25;i++){
if (array[i] != empty) {
perform memes
}
}
>>
>>57503381
define empty
>>
>>57503381
>C++
>not using std::array
>not using for (auto& v: array)

nigger do you even C++?
>>
File: definition_empty.png (46KB, 602x860px) Image search: [Google]
definition_empty.png
46KB, 602x860px
>>57503384
what's your point?
>>
>>57503401
>>not using std::array
How do you know this?

>>not using for (auto
How do you know he doesn't use i?

pajeet detected
>>
>>57503424
retard detect
>>
>>57503381
>>57503422
C++ has value semantics by default.
You're manipulating the object directly, not a container or a pointer, so empty is meaningless.
>>
>>57503422
what exactly is an "empty" element?
do you mean uninitialised?
if so, you can't detect that**

**except when you can
>>
>>57503381
usually
if(!array[i])
//array[i] is empty / uninitialized

this works only for objects
>>
>>57503424
Do you have brain damage?
>>
>>57503312
bumping this, it drives me crazy.
>>
>>57503432
>>57503441
>doing such an obvious samefag
>>
File: snap086.png (39KB, 499x604px) Image search: [Google]
snap086.png
39KB, 499x604px
>>57503462
You suck at samefagdetect
>>
File: 2016-11-14_00:05:18.png (11KB, 393x157px) Image search: [Google]
2016-11-14_00:05:18.png
11KB, 393x157px
>>57503462
try again faggot
>>
>>57503468
>>57503471

samefag
>>
>>57503478
Who are you quoting?
>>
File: 1474230127643.jpg (15KB, 306x306px) Image search: [Google]
1474230127643.jpg
15KB, 306x306px
>>57503478
>>
>>57503384
thanks senpai
>>
>>57503422
what is it an array of? if it's an array of pointers, you can use null pointers to signify "empty"
>>
File: 123210.png (7KB, 475x107px) Image search: [Google]
123210.png
7KB, 475x107px
>>57503462
kek nice try
>>
File: samefagging.png (46KB, 525x479px) Image search: [Google]
samefagging.png
46KB, 525x479px
>>57503471
>it's hard to manipulate
>>
>>57503535
that wasn't me he was just memeing.

I just defined "empty"

it was an array of LinkedLists so empty became NULL and array[i] became array[i].getHead()
>>
If you prove that I'm a samefag I will succ your dicc for free
t. cute girl
>>
>>57503599
>(55)
>>
>>57503576
Don't tell them our secret :^)
>>
File: 1369412449752.jpg (12KB, 200x200px) Image search: [Google]
1369412449752.jpg
12KB, 200x200px
>mfw all those faggots complaining about samefagging when all i want to do is help people with their shitty code
>>
>>57503603
>what is dynamic IP
This thread is infested with newfags huh
>>
>>57503619
Nobody's asking any interesting question to be quite honest familia
>>
>>57503619
show us your shitty code
>>
Recommend me some good yuri animes
>>
>>57503231
you're asking this question in a thread about programming
>>
>>57503599
hey cute girl, what does the t. part stand for?

wanna come over and teach me?
>>
What do you think of my TCP encapsulation class?

tcpserver.h
#ifndef TCPSERVER_H
#define TCPSERVER_H
#include <stdio.h>
#include <unistd.h>
#include <inttypes.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>

class TCPServer
{
public:
TCPServer(const char* port);
~TCPServer();
void tcp_listen();
bool tcp_send(const std::string msg);
bool tcp_read(char* buf);
bool tcp_close();


private:
void error(const char *msg);
int sockfd, newsockfd, portno;
socklen_t clilen;
int n;
char buffer[256];
struct sockaddr_in serv_addr, cli_addr;
};

#endif // TCPSERVER_H


tcpserver.cpp
#include "tcpserver.h"

TCPServer::~TCPServer(){
close(sockfd);
}

TCPServer::TCPServer(const char *port)
{
sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0)
error("ERROR opening socket");
bzero((char *) &serv_addr, sizeof(serv_addr));
portno = atoi(port);
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = INADDR_ANY;
serv_addr.sin_port = htons(portno);
if (bind(sockfd, (struct sockaddr *) &serv_addr,
sizeof(serv_addr)) < 0)
error("ERROR on binding");
}
void TCPServer::tcp_listen(){
listen(sockfd,5);
clilen = sizeof(cli_addr);
newsockfd = accept(sockfd,
(struct sockaddr *) &cli_addr,
&clilen);
if (newsockfd < 0)
error("ERROR on accept");
}

bool TCPServer::tcp_send(const std::__cxx11::string msg){
return write(newsockfd,msg.c_str(),msg.length()) > 0;
}

bool TCPServer::tcp_read(char* buf){
return read(newsockfd,buf,512) > 0;
}
bool TCPServer::tcp_close(){
return (close(newsockfd));
}


void TCPServer::error(const char *msg){
perror(msg);
exit(1);
}
>>
spent 8 hours trying to do this assignment

it was an emotional roller coaster but I managed to make it work. At times it looked very grim but I just kept going until there were no errors or bugs.

I'm so proud of myself
>>
>>57499593
Java, because of garbage collection.
>>
File: 123456789.png (153KB, 512x290px) Image search: [Google]
123456789.png
153KB, 512x290px
>>57503478
bruh, literally neck youself
>>
File: 1322002347508.jpg (54KB, 480x480px) Image search: [Google]
1322002347508.jpg
54KB, 480x480px
>>57503713
>blocking sockets
>is this the 90s?
>>
Can Unix be considered an IDE?
>>
>>57502829
>software has nothing to do with programming
if it didn't exist I was planning on making it...
>>facebook
oh I'm sorry anon, everyone has to hate what you hate right?
>>
File: avatar.jpg (6KB, 197x197px) Image search: [Google]
avatar.jpg
6KB, 197x197px
>>57503478
>>57503741
>samefagging this hard
>>
>>57503672
Not him but I'm not autistic and I'm always here.

Though, I guess you can regress into an autistic state if you are around stupid people long enough.
>>
>>57503713
It's fucking shit
>>
>>57503772
how do i implement non-blocking sockets without any fancy network lib?
>>
>>57503779
No, but it'd be like going to a feminist group for help with a trial on father's rights.
>>
>>57503805
google.com?q=epoll
>>
>>57503805
Look at the source of a fancy network library
>>
File: same.png (37KB, 346x173px) Image search: [Google]
same.png
37KB, 346x173px
>>57503780
try harder, rajesh
>>
>>57503834
Are you for real? It's a syscall, not a library.
You literally can't do networking without syscalls.
>>
>>57503844
alri 'Sheed
>>
>>57503818
>but it'd be like going to a feminist group for help with a trial on father's rights.
I see threads about facebook on g atleast once a week, yeah a lot of g is against it but g is mostly filled with gaming children and macbook normie programmers if this was r9k sure I wouldn't mention facebook but it isnt
>>
>>57503875
I never see facebook threads and I'm here all the time. But I'll indulge you on the matter and assume they are here. Try one of those threads instead for better results.

I'd help you myself if you weren't asking for me to look up a google api just to help you chat over cli. Do you know if it's even possible to create a 3rd party lib for facebook without explicit permission from some entity in the facebook corporate division? If so, it'd be as easy as pulling the stream into stdout, sending a response, waiting for signal and starting over. You can probably handle authentication at the per message level for something like that and it wouldn't be too heavy.
>>
>>57503844
>implying you can't remove that (you) from the browser debugger.
sure, buddy.
>>
>>57503965
alright I'll wait to see a facebook thread and try there also I've found a libary (I think it's called) https://github.com/carpedm20/fbchat had a quick read through the readme and think I could manage it using this - sorry I'm kind of new to all this thanks for the help
>>
File: imprettuysure.png (26KB, 1014x311px) Image search: [Google]
imprettuysure.png
26KB, 1014x311px
>>57503844
ummm...anon...
>>
>>57504000
I'll look through it too. If only to maintain a sense of civility about matters here. I was just trying to illustrate how annoying things can get if someone doesn't pay homage to the destructive nature of that culture. We wouldn't have so many autists here if it wasn't for that culture, you know.
>>
Do I need to use an iterator to swap between two adjacent elements by adjusting only the links (and not the data) using a single linked list? Or do I just use things like

p = beforep.next;
afterp = p.next;

p.next = afterp.next;
beforep.next = afterp;
afterp.next = p;


public static void swapWithNext( Node beforep )
{
Node p, afterp;
//...
}


I'm kind of thinking an iterator is only good if I'm trying to move the actual elements rather the links. Don't know if I'm misunderstanding, my notes didn't even include things like p.next; they just provided me methods of .next() for iterating
>>
File: 1404765201288.jpg (41KB, 738x362px) Image search: [Google]
1404765201288.jpg
41KB, 738x362px
Where is daisuki-senpai? Why isn't she posting anything recently?
>>
>>57504001
>missing image
yeah anon, totally not fake.
>>
>>57504025
>only good if I'm trying to move the actual elements rather the links
The links are the positions of the elements.
If you wanted to shift a node forward in the chain, you would need to
a) Make the previous node point to the node after the current
b) Make the next node point to the current node
c) Make the current node point to what the next node WAS pointing to

Which could be a lot of work, or very little, depending on what you're tracking inside of your Iterator
>>
Hey,

I don't know Javascript so forgive me the noob question:

I want to make a redirect from one site to another BUT:
parts of the original URL must be included into the URL which you're being redirected to.
For example: if I go to http://somesite.com/somedirectory/
I want it to save the "somedirectory" and include it into the URL which you're being redirected to, which would look like this then:
http://anothersite.com/somedirectory/

How do I do this? I don't know how to set variables like that from URLs in JS.

Any help is appreciated.
>>
File: butanon.png (38KB, 799x455px) Image search: [Google]
butanon.png
38KB, 799x455px
>>57504085
b-but anon...
>>
My Machine Learning wrapper just got added magnitudes of complexity.
This will take some time, I'm sure.
>>
>>57504085
>>57504188
>the memes have been stolen from the 4chan vault
I NEED A HIRO
>>
File: 1443024852711.png (125KB, 536x600px) Image search: [Google]
1443024852711.png
125KB, 536x600px
>>57504233
>>
>>57499525
What it the best encryption method against quantum computing that can be encrypted and decrypted in a reasonable amount of time?
>>
>>57500578
>implying that's a big deal
>>
File: 1472463157130.jpg (185KB, 534x1236px) Image search: [Google]
1472463157130.jpg
185KB, 534x1236px
>want to install a library on Windows, MinGW
>follow the instructions
>it doesn't work
Enough programming for today I guess
>>
>>57504285
non-existent
>>
>>57504285
AES-256.
Symmetric cryptography is not significantly affected, the best quantum attack just halves the key size.
>>
>>57504312
https://get.debian.org
>>
>>57504328
I would love to use Loonix but muh osu!
I don't play it as often anymore though, maybe I'm going to switch soon
>>
>>57504350
Dual boot and VMs are where it's at tbqh
I haven't booted my Win7 in months.
>>
Guys, pls respond to my issue here >>57504182
>>
>>57504188
so... you reply to yourself?
>>
>>57504368
>>>/g/wdg/
>>
>>57504368
Fucking Google it already, it's trivial.
The only skill you need as a developer is being able to fucking learn.
>>
>>57504368
[insert response here]
>>
>>57504000
Incase you're here and can actually do it yourself. Here are the links you could use.

https://github.com/carpedm20/fbchat/blob/master/fbchat/client.py

This file should have all the links you need to make calls for the receiving and sending the info. I think the ones you want and need are the login and messages links.
>>
>>57504375
Is self-sampling a crime
>>
Any book or online guide to start with nasm ?
Kinda got interested into asm
>>
Unrelated to anything but in case you don't know: かめりあ / Camellia is the new EDM god.
>>
>>57504123
So should I be using ListIterator or not?
>>
>>57504409

I don't really know much about nasm specifically, but if you're willing to buy a $5 pi zero, you could try this:

https://www.youtube.com/watch?v=ViNnfoE56V8
>>
>>57504409
You could also try something like this: https://www.youtube.com/watch?v=my39Gpt6bvY
>>
>>57501255
I'm trying to use it to design some pipe networks
>>
>>57504491
>>57504504
Thanks i have raspi laying around so i will try ^^
>>
>>57501418
>code::blocks or visual studio
In all honesty, GCC, Emacs and Make is the great compiling trifecta
>>
>>57504708
Emacs is gay
>>
File: TRUMP.jpg (294KB, 1066x750px) Image search: [Google]
TRUMP.jpg
294KB, 1066x750px
>>57501532
It over complicates the compiling and development process. a 5 line Makefile can do everything I need it to do, and I can add more stuff to the Makefile if I ever need it.
>>
>>57504708
name something better
>>
>>57504708
>>57504757

QT creator if you ever plan on using QT. Otherwise vim/VSCode/emacs/Sublime/Atom or whetever editor you enjoy that has a plugin
>>
is there a man page reader that allows you to follow links in the "See also: " section?

There has to be a better way of reading man pages than having 8 terminals open at once
>>
>>57504465
>>57504384
pic related

--
I'm trying to build a game in HTML 5 using cordova and watching pic related stooges. Trying to take a break from PHP/Python/C++ work shit and put some time into what I actually started programming for.
>>
>>57504840
https://www.kernel.org/doc/man-pages/
>>
>>57504708
Emacs is good, but if you like the UNIX way, I find using any vi clone and tmux can be just as powerful.
>>
>>57504840
A lot of implementations of man allow you to export to HTML.

Unfortunately that means you'll have to account for every hyperlink.
>>
>>57504840
>>57504926
Oh and if you're into the BSDs, they tend to have that on their websites. There's even a service out there that puts them all in one place, perhaps you could write a script that uses it.

http://mdoc.su/
>>
I have a java questions. If i'm calling wait on an object and if it waits too long I want to exit.

How do I do that? Using wait(1000) or some value will just stop waiting after that time and continue running.
>>
λ> let doubles = [x | x <- [1..], x `mod` 10 == ((x `div` 10) `mod` 10)]
λ> take 10 doubles
[11,22,33,44,55,66,77,88,99,100]
λ>


close to making a pure double checking script
>>
>>57504312
get Ubuntu if you want to do serious development (even in a VM). It makes everything so much easier
>>
>>57504312
>programming in anything but C# in windows
poor soul
>>
>>57504973
I found this while looking

it's pretty neat
https://www.freebsd.org/doc/en/books/developers-handbook/index.html
>>
>>57499525
I'm writing my own binary database format in Racket because I have nothing else to do. I've been able to get it to open a database file, write entries, and read those entries. The thing is that when I try to search an empty database then add an entry, the input port doesn't update with the new data. I need to force it to open a new input port on the new writes for, like, the rest of the session, otherwise it'll keep erroneously complaining that the keys I'm feeding it don't exist even though if I look at the hex for the database file, everything will be in order.

Maybe I'll ask around on the IRC channel or mailing list tomorrow after I've had some time to cool my head.
>>
>>57505037
Yeah, it's pretty good for something done by volunteers. Probably only really applies to FreeBSD though.
>>
>>57505045
no, if it is posix or SUS compliant, it is useful for everything
>>
File: ku.png (17KB, 900x900px) Image search: [Google]
ku.png
17KB, 900x900px
Was there any need to add "let" and "const" to JavaScript?

All we need is var. I'm sick of useless bloat.
>>
>>57505092
Honestly, they should throw out the entire language and start again.
>>
>>57505092
>Uses javascript
>Complains about bloat.

Memes aside var and let might be the slimmest change in ES6. Why do we need a class and extends keyword? Using your prototype was fine.
>>
>>57505126
this
>>
File: output.webm (171KB, 526x310px) Image search: [Google]
output.webm
171KB, 526x310px
Working on my terminal emulator, added support for setting window urgency on bell, now working on selection for copying.
>>
>>57505092
Do you even know what bloat means? They're just trying to fix the mistake that is JavaScript, and they're actually doing a pretty good job with ES6
>>
>>57505130
I don't know what ES6 'class' does, but if it just makes using prototypes easier it isn't an improvement. A good bit of the reason that JS is still slow is because stupidly deep prototype trees and having to search for methods.
>>
>>57505158
Very nice. How small are you planning to make this?
>>
>>57501301
the range always only includes the smallest number.
So you only need to search for it. O(n)
>>
>>57505161
It was a mistake everyone got used to and learnt how to use it.

JavaScript just isn't the same with proper scoping, it's not as fun.
>>
>>57505179
Define small, the features it will support are exactly the features I need, unless someone has some request that isn't a pain to implement and something I would never use.
>>
>>57505253
Smaller than rxvt, perhaps? Certainly can't be as small as st.
>>
>>57505253
What features are there so far?
>>
>>57505253
I would love to have cancer on Windows.
>>
>>57505253
It should build on wangblows without modification with gcc. Do an editor after that.
>>
>>57505266
Definitely smaller than rxvt, definitely bigger than st, at least feature wise.

>>57505267
Every terminal program I tried currently works, so let's say on the end of "terminal emulation" it will support what needs to be supported by real programs being used today, which actually excludes a shitton of stuff.

That aside, the terminal is modal, this means all input in "insert" mode (i.e. when using the terminal normally) is always sent the the software running within, this fixes issues where you have to press some combination to send mouse stuff to the underlying program or a switch in behavior bewteen programs supporting mouse and those that do not.

Basically you press this key combination, a status bar appears that tells you about some stuff, and you can move around the scrollback/view using vi-like bindings.

To paste you do need to get in normal mode, for example the sequence to paste from the PRIMARY selection would be (assuming the prefix is C-a) `C-a 1p`, for the SECONDARY `C-a 2p` and for CLIPBOARD `C-a p`.

Currently working on selections, so visual mode, and visual block mode from vim.

After that I'll make something that works like vimperator for opening URLs, the combination would be something like `C-a f h` assuming the URL you want to follow is tagged as `h`.

Other than that I'm not sure I need anything else.

Oh, and I'm going to add support for font ligatures, because I like the idea.

>>57505285
Windows support is planned, as is macOS support.
>>
so I'm reading about asynchronous IO right now and I came across this:


//main event loop
if (gotSigio) {
/* Is input available? */
/* Read all available input until error (probably EAGAIN)
or EOF (not actually possible in cbreak mode) or a
hash (#) character is read */
while (read(STDIN_FILENO, &ch, 1) > 0 && !done) {
printf("cnt=%d; read %c\n", cnt, ch);
done = ch == '#';
}
gotSigio = 0;
}


when the signal handler gets called, it sets gotSigio to 1 so the main loop can handle the new input

but what happens when I receive a new SIGIO signal right before
gotSigio = 0;

?
>>
>>57504491
>ARM
cancer
>>
>>57505356
>ARM
>cancer
ARM is GOAT
>>
>>57505092
you could write your js to a text file and have it be parsed prior to your saving it as a js file. That means you can write out your code with your let and const considerations in place, you just have your parser replace the let/const text for the expressions and process you want.
>>
>>57505356
shut your bitch mouth you little shit
>>
working on menus for my tv box.
>>
>>57505543
So you like your little smartphone. So what? I prefer the mouse since I play action games. I also use text editors without the input lag.
>>
Could I make some ez dollars by making a shitty soundboard Android app and calling it "Silly Soundboard!" and marketing to 11 year olds
I have no experience in Android programming but I've done Java for about a year now and I need money but don't want a real part time job at uni. What's the Play Store monetization like by adding ads to a free app?
>>
>>57505569
>implying ARM is the reason why input lag is a thing
That's like comparing PS/2 and USB. Beyond a point, you can't tell a difference. Even then, plenty of fast ARM cores is GOAT powersavings versus x86
>>
>>57505560
I also made this image by taking the exclusive or of the X and Y coordinates.
>>
>>57505345
maybe you could c asm setting sigio to 0 at the end of the call stack for that cycle. It would maybe do that thing your keyboard does when you try to press a key too many times fast.

Maybe you could set up input to be siphoned in from a separate thread and only allow the thread to write to the var at the end of a cycle?
>>
>>57505573
you get what you put into it

the hype is over, the app stores are declining, you can't put out absolute garbage and expect to get mad $$$ out of it

but if you make some actual good apps you can still make a solid profit of course
>>
File: 9947.png (3MB, 1920x1200px) Image search: [Google]
9947.png
3MB, 1920x1200px
>>57505640
That actually looks really cool
>>
>>57505651
reee this is supposed to be easy
>>
>>57505598
>That's like comparing PS/2 and USB
No, it's comparing Adapter->USB to Bluetooth. In the case of usb, I'd rather stick to working on my desktop. If I'm going to spend that much on a large enough tablet, I may as well get a small chromebook laptop with touchscreen and a built in keyboard.

Also, I don't care about power consumption if I'm going to be wired regardless.
>>
>>57505689
Are you talking about just tablets or all ARM computers? The Raspberry Pi and most Chromebooks are ARM based, and they both have the same input lag as their x86 counterparts
>>
>>57505663
I don't think there is a bubble with crappy apps. There will always be little shits out there who want stupid soundboards, "cleaners" for their phones, and the stupidest garbage
>>
>>57505671
Don't be so scared, it really is kind of easy. The registter math is c = a + b where, + is the call, c the holding register, a and b the following registers.

As for the second part, just make a new program that returns input from a function and find a way to tack that on to a new thread.

Doneso.
>>
>>57505703
Chromebook doesn't have the problem of peripheral keyboard. Raspberry Pi might not either but you're making arguments for smartphones.

Actually, I just read back and maybe you're not. Still, I don't think devs should work out of that kind of machine. But that might just be from personal experience with not so good technology.
>>
>>57505560
The actual project is supposed to be a decentralized TV streaming system. It can also be used as a full blown house surround sound system, but I haven't built the program enough for either of those to happen
>>
>>57505756
whoops, forgot the image.
>>
>>57505801
absolutely terrifying font anon
>>
>>57505830
I didn't want to rely on external files, so I just made multiple 6x8 blocks and crudely drew characters inside of them. When I implement lowercase, I will upgrade it to at least 10x10
>>
>>57505851
only autismos will use it if you don't get proper fonts
>>
>>57505851
This is pretty far from being 1.0, so I will upgrade. What fonts do you recommend? By the time that 1.0 comes out, I would have bothered with TrueType imports
>>
>>57505904
meant for
>>57505869
>>
>>57505851
i know it's you daniel
>>
>>57505964
no shit, it says that on the terminal
but seriously though, I thought you were somebody else
>>
>>57504840
If you use emacs, you can use its man reader, it even has a handy binding to skip right to the SEE ALSO section. I wish it didn't open a buffer for every page though.
>>
>>57505992
jej
>>
>>57506013
quality qeq
>>
Can I stop programming in my free time when I get a job? I have a life and want to spend time with gf + family. I'd prefer to not program outside of work. Do you guys put the computer away once you've punched out?
>>
>>57506021
I did until I start a serious personal project, then I dedicate a lot of my free time to it, but I don't feel enslaved to it at all. Getting /fit/ also helped cut down on wasting free time programming stupid stuff.
>>
>>57506021
no
>>
I want to watch my RAM usage go up so I'm running this code in a try block in c++:
for (int i = 0; i < 100000000; i++)
new int [9];

This uses about 2 gigs of ram before it crashes with no error message. Is windows killing it automatically? I still have plenty of empty ram left before it closes itself. If I use new int [999] I get a st9bad_alloc but not with new int [9]. How does windows detect I'm leaking memory?
>>
File: GhostOfYou.jpg (113KB, 816x1000px) Image search: [Google]
GhostOfYou.jpg
113KB, 816x1000px
Can anyone help me read this json api into R?

It is exit poll data for this past election. I am trying to do some analysis for a class but importing into R using JSON has me flustered.

Any help is appreciated.
>>
>>57506125
http://data.cnn.com/ELECTION/2016/full/P.full.json

Here's the link
>>
What is the purpose of adding an alias to a struct when you use typedef?

typedef struct Books {
// member data
} Book;


If book is just an alias for Books, why include typedef in the first place? i.e. whats the difference between above code and this

struct Books {
// member data
} Book;
>>
>>57506041
Between programming, work, and hitting the gym, how do you find time to have a social life? I'm in school and it feels like I can barely find time to work on personal projects after class and girlfriend and studying and occasionally going to the gym (once or twice a week). I'm producing maybe 20 lines of code a day now.
>>
>>57506159
Nothing in C++. In C, you would have to say "struct Books".
>>
>>57506173
in C if i were to use typedef would there be a difference between these declarations?

Books b2;
Book b2;
>>
>>57506159
try doing this:


struct Books{
int x;
} Book;

Book myBook;
myBook.x = 12345;



what happens
>>
>>57506209
The typedef makes it so you only have to write "Book" and not "struct Books".
>>
>>57505869
>>57505801
>>57505756
any suggestions for this? Here is a brief list of 1.0 goals
>IR remote control
>8K at 144Hz theoretical max resolution
>multiple channels on the screen at once
>variable frame rate
>multiple monitor setup
>giant, decentralized DVR
>exporting to other formats (DVD, MP4, upload through FTP)
>Sending out encrypted frames, and send a decryption key when it is supposed to air, so slower connections can experience higher quality footage
>Bitcoin donations to nodes and content creators
>>57506162
I keep a lot of mental notes of what exactly I need to do when I start programming. I almost always have my laptop with me (uni), so if i have a small idea, I just take it out and punch it out if it is small enough.

I don't hit the gym as much as I probably should (30 min. a day), but I got into the habit of getting up at 6:00 and doing it then, so at least i have the energy throughout the day.

I just hang out with people with shared interests (gymbro and some other nerdy people).
>>
>>57506220
>>57506210
ty
>>
>>57505158
can you just share the binary
I don't wanna install rust build system
pls don't give me home delete binary, thanks
>>
>>57506261
>Hang out with other people

I really can't stand other people in CS honestly. I can talk with them over the internet, but I can't find myself connecting with these people, let alone see myself wanting to spend time with them outside of school
>>
>>57506386
Most of my friends aren't in CS, but are in some other engineering or mathematics. Only one of them knows anything about programming, and we are working together on a little particle simulator, but he doesn't have Git, and refuses to get it.
>>
>>57506261
I also am implementing macro keys for the IR remotes to make them insanely powerful, along with a not-terrible keyboard for the IR remotes (ideally below 200ms delay, the IR code takes 110ms to send out)
>>
>>57506297
Not gonna happen, not until it's stable remotely complete.
>>
How do I read a string from the keyboard and put it into a structure element (inside a linked list) in C?

I'm having a massive brain fart right now
>>
>>57506523
>allocate linked list
>scanf or fgets to read the string
>assign that string to the element in the node of the linked list
>don't forget to free() your node's elements
>>
since signals aren't queued, how do I avoid the problem of receiving a signal when one is currently being handled?

do I
A: use epoll
B: use real-time signals
>>
>>57506767
epoll
>>
>Abelson: And the course these days has a loose enough structure that people can sort of get by learning whatever tiny little bit of Python they don’t know. Most of them know Java, unfortunately.
>unfortunately
LMAO
>>
File: fast.jpg (26KB, 764x146px) Image search: [Google]
fast.jpg
26KB, 764x146px
Is C++ that fast?
What's the fastest language?
>>
>>57507482
assembler
>>
File: 1374575706986.jpg (48KB, 640x368px) Image search: [Google]
1374575706986.jpg
48KB, 640x368px
>>57507482
>Claims to be performance oriented
>Doesn't even have restrict pointers
>>
>>57507505
but c++ compiles to asm?
>>
>>57507533
yes, that's why hand written asm will rape every other language.
>>
should i put all closing parentheses on the same line when doing any lisp
>>
>>57507563
That has the horrible assumption that you can write perfectly optimised assembly.
>>
Good morning, /dpt/
>>
>>57507589
Good morning, Anonymous.
>>
>>57507571
yes
>>
oops forgot my trip >>57507658
>>
>>57499525
Just a couple of start pages for my kids browsers.
So nothing much.
>>
How can I increment the value of an index of a vector by 1?
Like, lets say vector[5] stores the number 3. And I want to increment 3 to 4.
Is my only option:
int a = vector[5];
a++;
vector[5] = a;
>>
>>57507758
++vector[5];
vector[5]++;
vector[5] += 1;
>>
>>57507758
vector[5]++;

C and C++ can do this because a vector returns a lvalue if needed, some languages (go) cannot do this because indexes are rvalue only
>>
>>57507774
>>57507786

Yes, just what I wanted. What I typed out in my example seemed way too tedious.
Thanks.
>>
What's a good dev setup for Windows (besides dual booting Linux)? I've developed on OSX since the beginning and am unsure of life without a unix environment, homebrew, etc.
>>
>>57507816
If you are running Win10 1607+ you can install LXSS(or as marketing calls it Bash on windows). It is still a bit rough around the edges but it can run gcc or clang. No windowing support though so if you need more than a simple cli + sockets you will need to setup MinGW or use Visual Studio.
>>
>>57505018
What about deving video games, or software more than 3% of the computing world will use?
>>
>>57507905

Really the computing world can cope with linux

and anything with an end user will see with a GUI that does some shit will be probably be java anyway

As for video games? fuck off back to windows
>>
>>57507949
>anything with an end user will see with a GUI that does some shit will be probably be java anyway

gas yourself.
>>
>>57507583
A human directly writing assembly code has a hell of a lot better chance at than then indirectly through a compiler (which was also written by a human obviously) because the latter is more steps removed and has lost valuable context and problem specific knowledge.
>>
>>57499525
ok lads learning python working on my first script, I want it to have kind of limitless inputs i.e then could input a hundred variables or just one, is there anyway to do this? only thing I could think of is
if variableX = "done"
then
step2()

but other than that I've got no idea how any of it would work or be done
>>
>>57508047
Just iterate over inputs
x = []
while True:
our_input = input("")
if our_input == "done": break
x.append(our_input)

This will load x with a list of the inputs.
>>
>>57508086
and here's my ipython output when running this:
In [7]: x = []

In [8]: while True:
...: our_input = input("")
...: if our_input == "done": break
...: x.append(our_input)
...:
First
Second
Third
done

In [9]: x
Out[9]: ['First', 'Second', 'Third']
>>
>>57508086
>>57508097
now I'm going to sound like a fucking idiot but if for example I wanted to do first + third what names would I put would they be called "first" and "third"
>>
>>57508120
all i'm doing here is storing the inputs inside of an array, x.

you can access the first and third elements by calling x[0] and x[2] respectively.
>>
>>57508125
not array, list. technically different.
>>
>>57508125
alright I'm thinking I understand just to double check I could do something like
print (x[0])
and it would print first?
>>57508134
noted
>>
>>57508139
yes, exactly (assuming you're on python 3 btw...if you're not, you need to change some things in my code).
>>
>>57508158
alright man thanks a lot seriously, I am on python 3 <3
>>
>>57508170
of course, I love python and love helping people learn it. enjoy!
>>
New thread: >>57508333
Thread posts: 321
Thread images: 47


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