[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 | Extra juicy! | 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: 324
Thread images: 43

Old: >>47023148
>>
Just programming a meme xd so random on da 4chins
>>
trying to revamp my build system for my library I'm building. So far it works on wangblows but the tests won't build on linux
>>
Which does Wosniak approve of?

app.directive('helloWorld', function() {
return {
restrict: 'AE',
replace: 'true',
template: '<h3>Hello World!!</h3>'
};
});


or

App.directive('helloWorld', function() {
var directive = {};
directive.restrict = 'AE';
directive.template = "<h3>Hello World!!</h3>";
return directive;
});


Also, how the fuck do you pass parameters to directives?
>>
File: 1425302375079.png (290KB, 680x680px) Image search: [iqdb] [SauceNao] [Google]
1425302375079.png
290KB, 680x680px
>>47031276
>animeme picture
>>
Is it possible to create an Android app with only C++ compiled with the NDK?
>>
>wanting to be a programmer
>when you can be an astronaut
>>
>>47031554
By the way, is anyone familiar with CMake?
>>
>>47031601
Technically, sure... maybe.

Realistically, No, you're still gonna need to write a bunch of glue code in java.
>>
>>47031609

>wanting to be an astronaut
>when you can invent immortality and be a billionaire

Seriously, I feel like my life is just a lost ship in a storm being thrown about. I never wanted to be a programmer. It just fucking happened. Any time I try to direct the ship, it just find a shithole it has to run from.
>>
>>47031679
>wanting to invent inmortality
>more humans that can't die
>not joining the illuminati in the plan to reduce the human population
>>
what does /g/ think about static imports?
>>
File: fucked_up_vbo.png (9KB, 241x277px) Image search: [iqdb] [SauceNao] [Google]
fucked_up_vbo.png
9KB, 241x277px
And now we play the good old "have fun trying to find out why your vertex buffer is fucked up" game. At least it's not a black screen.
>>
>>47031640
only slightly
>>
>>47031739
Zalgo mode is a feature
>>
Can programming take me to NASA?
>>
File: Screenshot-2.png (112KB, 1270x796px) Image search: [iqdb] [SauceNao] [Google]
Screenshot-2.png
112KB, 1270x796px
Made a simple R web application for playing around with the Jacobi method.
>>
>>47031732
Well you are are suppose to programming in an OO style, so they should be avoided when possible.
>>
Asked this in the old thread but it died.

I'm thinking about becoming a programmer. Don't know too much about it, but I teach myself a little bit everyday. Soon I will be going to school for software engineering.

My only question is, is this a good field to get in to? Is the pay good, job security, flexible work schedule (as opposed to the standard 9-5), etc.? I know every position will be different, I'm just asking those who do work in this field what it's generally like. Sorry if this is the wrong thread to be asking in.
>>
>>47031747
nevermind I got it to work. Kind of... The library isn't built but the CMake system is in place
>>
>>47031808
*are suppose to be
>>
>>47031812

Yes, fucking do it. Med, engineering, and comp sci are master race. End of story. Finance + math/stats only works if parents have connections or ivy league.
>>
File: 1425731809772.jpg (121KB, 662x807px) Image search: [iqdb] [SauceNao] [Google]
1425731809772.jpg
121KB, 662x807px
I fucking hate modern computers.
Every single level of computers today is just layers and layers of retardation and terrible decisions, from circuit board design all the way up to high level applications.
I wish i could go to some far away land where computers don't exist yet, and then build my own computer from scratch, CPU architecture, peripherals, kernel, operating system, userland and internet protocol exactly how i fucking like it.
It depressed me that i'll never be able to achieve that.
Fuck everything.
>>
>>47031905
Fuck off autist
>>
I've asked this before (I think on Friday) but I'll ask again.
Is anyone interested in contributing to either a bit manipulation library or path recognition/comparison/prediction library?
>>
>>47031924
No, YOU fuck off.
>>
I have a file with entries that start all with @<, so like
@<A
//data
//data
@<B
//data
//data
//data
@<C
//data

etc. What would be the best way to read in all the entries into different class objects? I tried to iterate over the file and create objects as I hit @< but then I fucked something up with the iterators and it just kept getting stuck at one before EOF.
>>
>>47031609
being an astronaut is vastly overrated. what are you, five years old?

>>47031905
get help, and make sure you get your autism bux if you don't get them already
>>
>>47031947
Post the code that you have done so far.
>>
>>47031905
>I wish i could go to some far away land where computers don't exist yet, and then build my own computer from scratch, CPU architecture, peripherals, kernel, operating system, userland and internet protocol exactly how i fucking like it.
Why would you need to go to a far away land?
Just start building it right now.
>>
>>47032008
Because if he did go to a faraway land then he would actually have to commit himself to the task he supposedly wants to do.
>>
Anybody know any good SDL learning resources?
>>
>>47031905
Nothing is stopping you from building your own computer:

http://www.bigmessowires.com/bmow1/

>Big Mess o’ Wires 1 is an original CPU design. It does not use any commercial CPU, but instead has a custom CPU constructed from dozens of simple logic chips. Around this foundation is built a full computer with support for a keyboard, sound, video, and external peripherals.

Check out the other projects on that site too.

Now get to work.
>>
Not quite programming, but can you check with a query whether or not you have access to a certain table in mysql?
>>
>>47032008
>>47032067
I've actually been writing a virtual machine since new years that simulates my ideal computing platform, I've gotten tons of progress on it, i recently implemented a framebuffer, and plan to tackle persistent storage next.
But that's the most i can do, i can't do hardware shit, only software.
I plan to study CE and EE in uni.
>>
>>47031992

It's broken and shitty because i've been moving shit around but I'm trying something like this. Got it half-working before but only with the first row of the data...

void readFile(std::ifstream& ifs, std::string& filename) {
//Read the file containing molecules in, and store each individual molecule in a vector until further processing
//std::cout << "Reading in " << filename << "...\n";
std::string line, state;
std::istream_iterator<std::string> begin(ifs);
std::istream_iterator<std::string> end;
std::istream_iterator<std::string> it = begin;

std::vector<Molecule*> molecules;

while (it != end) {
if ((*it).find("@<TRIPOS>MOLECULE") != std::string::npos) {

//Create a Molecule object and store it in "molecules" vector
Molecule* comp = new Molecule();
molecules.push_back(comp);

std::cout << "First if " << *it << '\n';
comp->addLine(*it);
while ((*(++it)).find("@<TRIPOS>MOLECULE") != std::string::npos || it != end) {
comp->addLine(*it);
std::cout << "Second if " << *it << '\n';

}
}
}
}
>>
>>47032123

I'm not worried about fixing the code, I just can't get the logic down.
>>
>>47032076
SHOW TABLES;
will list all tables you have any rights on iirc.

SHOW GRANTS;
will list all permissions for the user that issues the query.
>>
>>47032101
if you don't do hardware shit then who are you to judge that everything is retardedly designed?
>>
>>47032150
That works, thank you
>>
File: 6.png (1MB, 1267x885px) Image search: [iqdb] [SauceNao] [Google]
6.png
1MB, 1267x885px
adding perlin noise gives some nice results to the dla procedural terrain
>>
>>47032204
>Static image
I'm a little disappointed.
>>
>>47031798
Is that Shiny?
>>
Does anyone write Java code outside of an IDE?
>>
>>47032230
webgl a shit
>>
>>47032189
Maybe not, but i am rather experienced in software development and i have a right to say that everything relating to software is fucking retarded.
>>
>>47032265
i pity the fool who writes java code outside of an IDE
>>
>>47032265
Unless you're using some other tool to compile the classes, not a chance in hell. Have you ever tried compiling a multi-package project from the command line?
>>
>>47032265
Maybe?
>>
>>47032265
I write Java in Emacs, but I consider that a OS.
>>
>>47032291
Yes, I have. Just learn to reformat errors into a log and there you go.
>>
>>47032288
http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
>>
>>47031276
Why the fuck is she holding the book upside down?
>>
>>47032236
Yes, it is.
>>
>>47032339
So that you can read the title anon.
>>
File: out.png (3MB, 1920x1200px) Image search: [iqdb] [SauceNao] [Google]
out.png
3MB, 1920x1200px
My image processor i am working on went a little screwy
>>
>>47032265
Indians
>>
>>47032358
looks like a wrong stride
>>
>>47032340
Looks nice. I might have to try it out sometime; R evangelists sure love to talk it up. Are you a statistician or some sort of analyst, by chance? Always nice to see projects in these by people who aren't just developers.
>>
>>47032446
yep, off by one error... again
>>
>>47032358
fuck yeah tornado evangelion
>>
File: out.png (2MB, 1920x1200px) Image search: [iqdb] [SauceNao] [Google]
out.png
2MB, 1920x1200px
>>47032526
Ok, got it done now
:D
>>
Doing some windows phone app development
>>
>>47032578
http://en.wikipedia.org/wiki/Glitch_art
>>
>>47032578
That's neat. Thanks anon.

>>47032608
This art is pretty nice.
>>
File: out.png (2MB, 1920x1200px) Image search: [iqdb] [SauceNao] [Google]
out.png
2MB, 1920x1200px
>>47032640
If you want the script, i can put it up. I have 2 things you change for different banding effects. I am about to make it so that you can do negative band shifting to shift in the other direction (go right and not left)
>>
>>47032640
I remember I made a bunch of these glitched pictures and gifs with many anons at [spoiler]420chan[/spoiler], melting effects on gifs are pretty cool, writing an algorithm to make these effects shouldn't too hard.
>>
>>47032668
Yes, I want it.
>>
>>47032668
Now animate it.
>>
>>47032483
Actually I was just testing out the Shiny development environment. I attended an R course a year ago during my exchange studies and have been doing small stuff with it, such as reading xml files, using databases and such. I only recently found Shiny. I don't have any other experience with web development.
>>
>>47032692
You guys use Matlab, I guess?
>>
Does
sudo apt-get install git

Install everything I need on my end for github or even on my own network git work?
>>
File: out.png (2MB, 1920x1200px) Image search: [iqdb] [SauceNao] [Google]
out.png
2MB, 1920x1200px
>>47032708
challenge accepted, though the runtime is gonna suck. Currently, it takes 1.3 seconds on my computer for the single image. Now i got the negative shifting to work.

One last thing before animation, more than one imagewidth fo rthe band rotation
>>
>>47032123

I think I've fixed it...is this okay or am I doing something very redundant?

void readFile(std::ifstream& ifs, std::string& filename) {
//Read the file containing molecules in, and store each individual molecule in a vector until further processing
//std::cout << "Reading in " << filename << "...\n";
std::string line, state;
std::istream_iterator<std::string> begin(ifs);
std::istream_iterator<std::string> end;

std::vector<Molecule*> molecules;

std::vector<std::string> tempStorage;

for (std::istream_iterator<std::string> it = begin; it != end; ++it) {
if (state == "") {
if ((*it).find("@<TRIPOS>MOLECULE") != std::string::npos) {
std::cout << "Found a molecule...\n";
state = "READING";
tempStorage.push_back(*it);
}
}
else if (state == "READING") {
if ((*it).find("@<TRIPOS>MOLECULE") != std::string::npos) {
std::cout << "Found a new molecule, saving old one...\n";
Molecule* comp = new Molecule(tempStorage);
molecules.push_back(comp);
tempStorage.clear();
state = "";
}
else {
tempStorage.push_back(*it);
}
}
}
}
>>
>>47032710
With Microsoft's purchase of revolution analytics we're probably going to see R# in the future, which will enable Shiny-like web applications in asp.net, exciting.
>>
Am I doing this right?

if worldcollision( objHB ) then
x = x - ( varxSpeed * dt() )
setHB()
end


int luaWorldCollision( lua_State* L ) { 
strHitbox lHitbox; /* initialize temp hitbox */

lua_getglobal(L,"objHB"); /* grab hitbox */
lua_getfield(L,-1,"x"); /* set hitbox x */
lHitbox.x = lua_tointeger(L,-1);
lua_pop(L,1);
lua_getfield(L,-1,"y"); /* set hitbox y */
lHitbox.y = lua_tointeger(L,-1);
lua_pop(L,1);
lua_getfield(L,-1,"w"); /* set hitbox w */
lHitbox.w = lua_tointeger(L,-1);
lua_pop(L,1);
lua_getfield(L,-1,"h"); /* set hitbox h */
lHitbox.h = lua_tointeger(L,-1);
lua_pop(L,1);

if( WorldCollision( &lHitbox ) == true ) {
return true;
} else {
return false;
}
}


Do I need that parameter in the lua file? I would prefer to use it, as I know getglobal doesn't need it. I want to get what I have no fully working before I move onto metatable stuff. Also, I haven't tried it, but say the function in C has getglobal and setglobal, but those items dont exist in the lua script, would this cause a crash, or is there a way to set it up so that there is no crash? Thanks
>>
File: 1420623292094.png (115KB, 850x800px) Image search: [iqdb] [SauceNao] [Google]
1420623292094.png
115KB, 850x800px
>>47032873
>>
>>47032940
//this is bridge
>>
So graphics programmers have SIGGRAPH, what do web devs have?
>>
>>47032969
canvas and javascript
>>
>>47032977
I mean a equivalent conference
>>
>>47032733

Anyone?
>>
How would I use gethostbyname() in C++ for IRC? For example, I want to connect to irc.rizon.net. How would I do this?
>>
>>47033002

nm ill just install it and see what happpens.
>>
>>47033002
Are you seriously asking that?
>>
I have this code

char charray[] = { "ur", "a", "dong" };
cout << chararray[2] << endl;


How do I split this into an actual array by delimiter?
>>
>>47033066

Was wondering more if there were additional things to install.

Never touched it before thought it might be multi part or use a different program with it.
>>
File: out.png (2MB, 1920x1200px) Image search: [iqdb] [SauceNao] [Google]
out.png
2MB, 1920x1200px
Got the multiple width of the image done

#!/usr/bin/python
numberOfBands=1200/42
unshiftRatio=-.25

from PIL import Image
from math import floor

image=Image.open("image.jpg");
pixelsOriginal=list(image.getdata())

print type(pixelsOriginal),len(pixelsOriginal),image.size[0]
print image.size[0],'x',image.size[1]

pixels=[]
count=0
while(len(pixelsOriginal)>count):
pixels.append(pixelsOriginal[count:count+image.size[0]])
count+=image.size[0]
del pixelsOriginal

#move the bands
def rotateLeft(line,number): #rotates the bands to the side. Dont let the name fool you as a negative unshiftRatio will shift it right
number=int(number)
negativity=1 #assume we are doing a positive shift
if not number==0:negativity=abs(number)/number #is it negative
while(abs(number)>len(line)): # if too big then change the shift
number-=len(line)*negativity # make it smaller (also, if negative, add to make it smaller)
return line[number:]+line[:number]

bandHeight=image.size[1]/numberOfBands
shiftDistance=int((image.size[0]/numberOfBands)/unshiftRatio)
if bandHeight==0:
print "Height Issue, your number of bands is likely too large"
bandHeight=1

for num in xrange(len(pixels)):
pixels[num]=rotateLeft(pixels[num],floor(num/bandHeight)*shiftDistance)

#recombine the pixels and save
pixelsShifted=[]
for line in pixels:
pixelsShifted+=line

image.putdata(pixelsShifted)
image.save('out.png')
>>
>>47033026
Have you read Beej's guide to network programming? I did and really liked it, it's a good book to get into C++ network programming
>>
Why haven't you joined yet? https://github.com/The-Feminist-Software-Foundation
>>
>>47032940
i should remove the squiggly brackets, but I am returning either 0 or 1 to lua, thats the simplest thing to do
>>
>>47033330

I wonder if there is some quiet majority that just wants to kick all the fucks out of feminism.
>>
>>47033330
>This repository has been disabled.
>>
>>47033104
T h a n k s !   
T h a n k s !
! T h a n k s
s ! T h a n k
k s ! T h a n
n k s ! T h a
a n k s ! T h
h a n k s ! T
T h a n k s !
>>
>>47033334
>thats the simplest thing to do
No it's fucking not, returning WorldCollision(&lHitbox) is.
>>
>>47033104
seems like this could be done a lot more succintly with
http://docs.scipy.org/doc/numpy/reference/generated/numpy.roll.html
>>
wtf my post disappeared

>>47033104
seems like this could be done a lot more succintly with
http://docs.scipy.org/doc/numpy/reference/generated/numpy.roll.html
>>
File: uakari.jpg (148KB, 500x500px) Image search: [iqdb] [SauceNao] [Google]
uakari.jpg
148KB, 500x500px
>>47033532
>my post disappeared
>>47033509
>>
>>47033461
almost got animated somethings.....
maybe........

>>47033532
that is really neat. Doesn't scipy require extra stuff. I am trying to keep it as vannila as possible.
>>
>>47033554
>implying that's 100% the same poster
>>
>>47033554
i swear it did. i was on this page and the little [deleted] thing showed up next to it and it wasn't there when i refreshed. that's really fucking strange.
>>
wtf my post disappeared

>>47033554
>implying that's 100% the same poster
>>
>>47033571
it's just numpy you've got two imports anyway
>>
>>47033508
okay Xr.GNUOCD
>>
This function is big and ugly, how do I make it small and pretty?

def getAvgPos(posList):
sumx = 0
sumy = 0
for x,y in posList:
sumx += x
sumy += y
avgx = sumx/len(posList)
avgy = sumx/len(posList)
if (avgx, avgy) not in successor.getWalls().asList():
return (avgx, avgy)
else if (avgx, avgy+1) not in successor.getWalls().asList():
return (avgx, avgy+1)
else if (avgx, avgy-1) not in successor.getWalls().asList():
return (avgx, avgy-1)
else if (avgx-1, avgy-1) not in successor.getWalls().asList():
return (avgx-1,avgy-1)
>>
>>47033936
You don't need to call getWalls().asList() so many times. Just save the result of the operation in variable.
Also, isn't '/' a float division? Seems like you want integers, not floating point numbers.
>>
Can anyone tell me why the
 install TARGETS ${samplename}... 


fails

project(bitmanip c)
cmake_minimum_required(VERSION 2.6.2)

#bitmanip folders
set(bitmanip_base ${basepath}/bitmanip)
set(bitmanip_src ${bitmanip_base}/src)
set(bitmanip_samples ${bitmanip_base}/samples)

#head file inclusions
include_directories(${BASEPATH}/include)

#libraries
link_directories(${BASEPATH}/lib)

#make the library
file(GLOB bitmanip_sources ${bitmanip_src}/*.c)
add_library(bitmanip ${bitmanip_sources})

#make the samples
file(GLOB bitmanip_samples ${bitmanip_samples}/*.c)
foreach(samplesourcefile ${bitmanip_samples})

string(REPLACE ".c" "" samplename ${samplesourcefile})
add_executable(${samplename} ${samplesourcefile})
target_link_libraries(${samplename} bitmanip)
install(TARGETS ${samplename} DESTINATION bin)

endforeach(samplesourcefile ${bitmanip_samples_sources})


install(TARGETS bitmanip DESTINATION lib)
>>
I'm new to programming and need some help understanding OOP.

I have an object (game), in which I have two objects (room, player).

Is there a way to use a method of 'room' from inside 'player'?

Basically, I'm trying to ask the room if the space I want to walk to is free, from inside a player method.

Example:

[Code]class Game():
def __init__(self):
room = Room()
player = Player()

class Room():
def check_space(space):
stuff

class Player():
def action():
if room.check_space(space) == 'empty':
self.move()[/Code]

Programming language is Python (+ PyGame).
>>
>>47033071
char chararray[][]

That's what you mean right?
>>
>>47034175
whelp

class Game():
def __init__(self):
room = Room()
player = Player()

class Room():
def check_space(space):
stuff

class Player():
def action():
if room.check_space(space) == 'empty':
self.move()
>>
>>47034200
fuck me

class Game():
def __init__(self):
room = Room()
player = Player()

class Room():
def check_space(space):
stuff

class Player():
def action():
if room.check_space(space) == 'empty':
self.move()


really sorry
>>
>>47034144
figured it out. Nevermind
>>
>>47034216
Just don't confuse classes and instances of those classes.
Also, if you make an instance of Room class inside an instance of Game class, you'd need to assign it with self.room = Room() in order to be able to call its functions like this:
g.room.check_space(space)
Assuming you created "g" instance of the Game.
>>
>>47034324
Yeah, I omitted self. to keep it as simple as possible.

Can't I access an instance of something from an instance of something else?
>>
>>47034407
Sure. In this case, if the instance of the game is assigned to a global variable g, you can call g.room from g.player.

Also, don't forget to add "self" as the first argument when defining functions that belong to a class.
>>
I know I'm not supposed to ask /g/ for help with projects and such, but I'm desperate. What do these functions mean and how do I implement them? Specifically, lines 56 through 66. It's C++ by the way.
>>
>>47034608

IS that just Matrix stuff? Comparing MAtrixs adding them subtraction?

Scaler means instead of multiplying two matricies your scaleing them as in lets say int = 2 then that would double the size of the matrix.

I dont know c++,
>>
>>47034586
It's not working for me, not sure what I'm doing wrong.

This is the actual code:
https://github.com/Nanen/Shinri-Denki/tree/Remake

And this is the line I'm wondering about if such a thing exists:
https://github.com/Nanen/Shinri-Denki/blob/Remake/player.py#L77

I tried game.self.room.METHOD and room.METHOD, but it's not working.
>>
>>47034608
http://en.cppreference.com/w/cpp/language/operators
>>
Man, mixing INotifyPropertyChanged and multi-threaded applications is an enormous pain in the ass. For every class you have to make sure the UI notifications are raised in the right thread...
>>
>>47034199

Great, now I understand how to use char arrays now. I need to split a string from a delimiter into a char array now.
>>
>>47034608
i wish more languages had user-defined operators.
>>
File: tep.png (5KB, 626x345px) Image search: [iqdb] [SauceNao] [Google]
tep.png
5KB, 626x345px
Not precisely "programming", but I'm taking a break from programming in order focus on the website that I wanted to build.

>inb4 drugs are for degenerates
>inb4 tables, what is this? 1996?
>>
>>47034997
Said no one, ever, since the emergence of C++.
>>
>>47034748
Well, I didn't go through all the code, but maybe it'd be best if you created player with room as argument and stored the room as self.room? Then the player could use the room like this: self.room.check_space(self.target_space)
>>
>>47034705
Yes, but my question is how would I implement them? I don't understand the syntax in the header and how to implement it. Thanks, anyways.

>>47034800
Thanks, anon. I think I now understand.
>>
Yeah!
I think that will work, thanks!

self.room wouldn't just be a copy, but the actual, changing thing, right?
>>
>>47035156
Yes. You'd have to make a deep copy in order to copy the instamce.
>>
File: 1325360328216.jpg (43KB, 640x480px) Image search: [iqdb] [SauceNao] [Google]
1325360328216.jpg
43KB, 640x480px
>CS student doesn't know why creating, simulating and destroying tens of thousands of objects is resource intensive
>>
>>47035746

Why the fuck doesnt that degree have more programming in it?

What do people egt that degree for besides programming?
>>
>>47035760
Wanking around. Any degree which builds on a base should teach that base first or inform the students they need to get it.
>>
File: 1327282004736.gif (1MB, 200x113px) Image search: [iqdb] [SauceNao] [Google]
1327282004736.gif
1MB, 200x113px
>>47035760
I don't know Anon, I'm convinced they don't teach them anything, I've heard some of the most retarded shit in my life from CS students.
>>
>>47035832

Its math right?

Like some post calc probably. And then just what physics?
>>
>>47035746
>student doesn't know something

I wonder why
>>
>>47035853
>Its math right?
not according to /g/.
someone posted Santiago Gonzalez's mathematical outline for some program and they shit all over it because they couldn't understand it.
>>
>>47035746
I wouldn't blame the programme as much as the person.

You are retarded if you don't know that whether you have an education or not.
>>
>>47035853
I don't think so? they don't know linear algebra in their 3rd year, I've literally seen some maths major shitting all over them.
>>
>>47035916
We had linear algebra here in the first year.

The professor was a sleeping pill though, one of the worst courses I've taken so far.
>>
>>47034175
Python is one of the worst OOP languages there is. If you're going to use a game, just use Java or C or something.
>>
>>47035916
At my school linear algebra was required in second year, along with either multivariable calculus or a stats course. Most of the math you do in CS is of a different sort than linear algebra or calculus, though. Mostly proving that such and such algorithm has some property.
>>
>>47035905
I can't choose to believe that any more, I've met too many people from different computer science departments and universities and they're all equally as retarded.
>>
>>47035967
Granted, it's not really meant to be used in games and other heavy tasks.
Otherwise it's a great language if you just want to get shit done quickly and with ease.
Why are so many people here shitting on Python?
>>
>>47036068
What I think is actually happening is that people who don't really care are getting degrees and jobs, so you're more exposed to retards with degrees than retards without degrees since it's easier to get a job with a degree. And some confirmation bias.
>>
>>47036090
>Why are so many people here shitting on Python?
They're the same people that learnt it back when interpreted languages were all the hype and thought everything would be rewritten in them, now their former stewardesses are abandoning them they've turned to self-hatred.
>>
>>47036090
python is a scripting language. It's very useful if you want to write small scripts for useful things
but any real program should be written in a real language
>>
>>47035746

But it sure feels amazing. And this is 2015, after all.
>>
>>47036090
Because, like you said, it really is just a language meant to do small little things, hence why it's so valuable in other tasks like pen testing.
But you get all these fags trying to lern 2 code lululululul Xb compter scic! using python it's become a manifestation of "shut up kid, I'll hack you."
It's simplicity is it's own downfall in that way, in that in most areas, the language is weak. It's basically the opposite of Perl, where everything is super powerful, but it looks like it just came out of RSA.
>>
>>47036121
And vice versa, since the retards will teach other people one day.
>>
>>47036145

That sort of shit really pisses me off. It happened to lua as well, just in a different way.

Now lua is the official "u progrm for gawy's mawd, too? xDDD le g-man maymay"

I bet Roberto Ierusalimschy contemplates suicide daily for creating the language that would drive garry's mod.
>>
>>47036090
Python is the new BASIC. As long as you treat it as such, there's no problem.
>>
Does anybody kind of wish more language would come with built in interpreters for RPN? It would make compilation easier and it would make math, for me at least, a lot easier.
>inb4 we go back to assembly
>>
Anyone help me with
>>47036221
>>
>>47036145
>It's basically the opposite of Perl, where everything is super powerful, but it looks like it just came out of RSA.
I'm really curious, what are the main differences? Why is Perl more powerful than Python?
I personally dropped Perl and chose to learn Python because of the tons of modules available for it. I consider it kind of a "jack off all trades but masturbate none" scripting language.
>>
these threads are big enough that we should start making separate threads for each language
>>
>>47036320
A lot of conversations aren't specific to languages, and some discussion would be restricted if comments had to be kept to one language. Thinking of programming as restricted to language is not a good way of thinking
>>
File: 福原遥12.jpg (17KB, 432x243px) Image search: [iqdb] [SauceNao] [Google]
福原遥12.jpg
17KB, 432x243px
>>47036320
Dude no.
>>
>>47036309
One major reason is that Perl has built-in regular expressions, It's at its very core, Perl is fucking regular expressions.

in Python it's just a tacked on half-developed library.
>>
>>47036309
Personally, I haven't used Perl in a long time (or python for that matter,) but from what I remember, Perl was better for security reasons; no buffer overflow possibilities as all variable types are allocated post assignment, hence the $ for string, @ for array, you get the idea. If I remember correctly, php was even made based off of perl because of it's usage in server side computations, because once again, it's unique allocation style allows for minimal processing power for computations. It's basically really complicated, but really useful for managing a lot of different requests at once. However, the downside is your code looks like you just sat on the toilet and took a huge shit all over your computer.
>>
>>47036309
Almost forgot about hash support. Perl does hashing really well.
>>
>>47031905
Start reading, autist.
http://www.amazon.com/Fundamentals-Digital-Logic-Microcomputer-Design/dp/0471727849/ref=sr_1_2?s=books&ie=UTF8&qid=1426466175&sr=1-2&keywords=Rafiquzzaman
>>
>>47036320
it's not like /agdg/ where the threads last minutes or something crazy like that. we used to have lisp and graphics programming generals sometimes but they weren't popular.
>>
>>47036373
>>47036381
>>47036409
Thanks. I really loved built-in regex in Perl too. That's where I learned to use it, and basically that's all I remember from Perl.
>>
>>47036454
we still have lisp
>>
>>47036476
The last thread died with like 27 replies in it though.
>>
I know C#. I want to get into developing android apps. Should I bother with learning java? It's all as a hobby, so I don't care how employable it makes me [or doesn't]. I see a lot of people say C# is just java but better, which puts me off wanting to learn it, and I know C# is perfectly fine for android apps with shit like xamarin. Would there be any benefit to offset the opportunity cost of learning java to make android apps?
>>
Why I feel uncomfortable with almost any language except C++/C or C#
>>
>>47031905

I'm sorry we failed you, RMS.
>>
>>47036578
because you don't have enough experience with other languages to feel comfortable with them
start a project in a different language and work on it on your own time by yourself, but make sure it's somewhat challenging
>>
>>47036572
>Should I bother with learning java?

You pretty much already know it. For a hobby, at least start learning C++ or something, at least that's different enough.
>>
>>47036572
If you plan to make any program, even as a hobby, you really should be multi-lingual. If you know C#, java is like picking up a spoon. It might take you a couple days at most to get an almost complete grasp of it.
>>
>>47036572
xamarin seems like such a round-about way of doing it and you'd still have to learn xamarin. C# is just a shitty clone of java, you'll learn java in a breeze.
>>
>>47036622
>C# is just a shitty clone of java

You take that back, you.. you.. DOUBLE NIGGER.
>>
>>47036622
>shitty copy of java
>>
>>47036622
see >>47036628, you disgusting kike.
>>
I just installed curl for linux. Seems like it needed to transfer url's to git for downloads.

Anything I need to know security wise? Just dont click on links I dont know?
>>
File: 1327777453576.jpg (72KB, 800x450px) Image search: [iqdb] [SauceNao] [Google]
1327777453576.jpg
72KB, 800x450px
>>47036622
>C# is just a shitty clone of java
>>
>>47031555

Why TF would you pass parameters to directives. They aren't supposed to do anything except use the controller's scope.

Use $scope in function($scope) if you have to ya lazy fuck.

http://stackoverflow.com/questions/13725938/angularjs-how-to-pass-arguments-functions-to-a-directive
>>
Where do I go or what do I read to understand XMPP and everything surrounding it like STUN and all that shit? Would learning this be beneficial for human communication over the network or should I learn about IRC instead?
>>
But if I'm honest, I do love C# and Java very much. I should make an effort to get back into C++, because I haven't used it since I took an advanced C++ concepts class (or whatever the fuck it was called then).
>>
>>47036707
For your own sanity, I recommend IRC unless you think your problem has needs that IRC cannot address. I've looked at both protocols. IRC is clean, elegant, and easy to implement. You can even just implement a subset of IRC and still get pretty good functionality. XMPP is very "Enterprise" in comparison.
>>
>>47036707
You won't learn anything from reading about IRC, the protocol was considered dumb and dated when it was created.
>>
>>47036740
Good to know, thanks.
>>
I posted too quick.
>>47036748
Do you suggest any alternative protocol?
>>
File: church-curry.png (225KB, 596x600px) Image search: [iqdb] [SauceNao] [Google]
church-curry.png
225KB, 596x600px
(defun kekify (string)
"Kekify the string to copy-pasteable output"
(format t "~a~%" string)
(let ((kek-collection))
(setf kek-collection
(loop for a across string
for b across (reverse string)
:with len = (length string)
:with padding =
(concatenate 'string
(loop for i below (- len 2) collect #\space))
:collecting
(concatenate 'string (string a) padding (string b))))
;; remove first element
(pop kek-collection)
(loop for n below (1- (length kek-collection))
:do
(format t "~a~%" (nth n kek-collection)))
(format t (reverse string))))

it's all yours
>>
I'm looking to make an image tagger with mysql or postgresql.
For the gui I'd like to enter tags and lookup them and display thumbnails.
What gui toolkit should I use? I like gtk or qt so I think I'll go with one of those, using python or c++ or both.
>>
>>47036868
https://hydrusnetwork.github.io/hydrus/
>>
File: 1419581720718.png (80KB, 600x565px) Image search: [iqdb] [SauceNao] [Google]
1419581720718.png
80KB, 600x565px
For anyone that's worked with Android using the NDK, are you supposed to use an OpenGL function loader before using OpenGL?

What about for iOS?

And in general, how the fuck am I supposed to find this kind of information out because Google isn't helping at all
>>
>>47036748
I don't think the IRC protocol is dumb or dated. There are some oddities or things it doesn't handle as well. Things like authentication (nickserv), channel ownership; network splits, etc. IRC isn't perfect from that standpoint, but it does have solutions even if they aren't directly part of the protocol. If you need strict authentication rules, worry about the security of nickserv, require more fine grained permissions, need VoIP support, then IRC probably isn't the best for the job. IRC isn't "infinitely extensible" the way XMPP brags about, but that's also why the core functionality is so much more easier to implement. For fucks sake, I've heard of people typing IRC protocol commands directly into fucking telnet on machines which didn't have an IRC client available. If someone is asking /g/ of all places for advice, then I'm going to strongly suspect they're not working for a Fortune 50 and implementing an internal corporate messaging system. They're probably just dicking around. In that scenario, IRC is much better for them.
>>
>>47036916
You're missing the point, there's literally nothing to learn about IRC, It's that simple, literally just netcatting strings simple.
>>
Where is $HOME in linux? As in Vim says my vimrc file is located in $HOME/.vimrc
>>
>>47037007

ignore that

there is no .vimrc file in my home directory should I create it?
>>
Anyone knows about this library http://oglplus.org/? I need to do some shit in raw OpenGL and I'm not really with time to write all the boilerplate on top of OGL.
>>
>>47036899
People actually comment like that?
>>
Hey /dpt/

for some reason,
    for (i = 0; i < lim; i++) {
while (ch1 = getc(first) != '\n')
putchar(ch1);
putchar('\n');
while (ch2 = getc(second) != '\n')
putchar(ch2);
putchar('\n');
}

only prints the newlines, and then I have to kill it with ^C. lim is found like this:
    fseek(first, 0L, SEEK_END);
fseek(second, 0L, SEEK_END);
fsize = ftell(first);
ssize = ftell(second);
// rewind(first);
// rewind(second);
fseek(first, 1L, SEEK_SET);
fseek(second, 1L, SEEK_SET);
if (ssize > fsize)
lim = ssize;
else
lim = fsize;

yet, if i set lim to say, 200, manually, i still have to kill it. How else can I do this so it actually works? Thanks
>>
File: 1425767449150.jpg (43KB, 512x512px) Image search: [iqdb] [SauceNao] [Google]
1425767449150.jpg
43KB, 512x512px
>Tfw you have Perl and C++ assignments to do and you're just shit posting on /g/.
>>
>>47037022
If you want a vim profile yeah
>>
>>47037090
Use Qt if LGPL is okay
It just werks
>>
>>47037120
shit
Also, I've uncommented the rewind()s and gotten rid of the latter pair of fseek()s, still same thing.
>>
File: 1382502212856.jpg (62KB, 396x385px) Image search: [iqdb] [SauceNao] [Google]
1382502212856.jpg
62KB, 396x385px
>>47037123

>Spring break starts tomorrow
>Professor wants me to go see him to finish a lab experiment
>>
>>47036899
>For anyone that's worked with Android using the NDK, are you supposed to use an OpenGL function loader before using OpenGL?
i'm wondering this too. i'm relying on calling OpenGL functions from java via libGDX instead of from my native code but for my next more ambitious game i should really be calling them directly from the native side if possible.
>>
>>47037007
It's pretty self-explanatory, but you can check it yourself:
echo $HOME
>>
>>47036899
>>47037184
btw you can check out libGDX's internal code in Gdx.gl20 and see how they do it
>>
Here to ask more questions. What a surprise. Anyway, I am making a IRC bot. I started this project on Saturday and I think I've made a lot of progress on it. It currently connects to the IP I specify it to connect to and then says "hey niggers". It then sits there and sends a PONG back to the PING that the IRC server sends. What I'm having a problem with is this, I want to say .help and then have my bot PRIVMSG the sender of the message and then prompt a list of commands available. How would I do it, and if you don't mind, show me how? My code is here

http://pastebin.com/SfvuhDM2

If you help me, thanks in advanced. I greatly appreciate any support/feedback I can get on this journey I'm embarking on.
>>
>>47036889
>https://hydrusnetwork.github.io/hydrus/
> It is developed mostly for Windows, but fairly functional builds for Linux and OS X

nope.jpg (need to make a nope tag)
>>
I dont under stand why would this be 49?
int x = 10;
int y = 10 + x--;
y = y * 2;
System.out.println(x + y);
>>
>>47037327
post vs pre increment. The x isn't set to 9 until after the rest of statement is evaluated.
>>
>>47037327
line 1: x = 10
2: y = 20; x = 9 (added x to y before decrementing)
3: y = 40;
4: x + 7 = 40 + 9
>>
>>47037350
 
int x = 10;
int y= 10 + --x;
y = y * 2;
System.out.println(x+y);

Is what you're thinking it is doing.
>>
Hey I am completely lost on how this works and doesn't crash.
http://pastebin.com/3TXGaw2
It's from this video.
https://www.youtube.com/watch?feature=player_embedded&v=HQYsFshbkYw
I've laid out a few comments in the pastebin but I'll just address my main one and you can refer to the pastebin for greater clarity (if you need or please).

int* num = NULL;
sscanf(ptr += n, "%f%f%n", &sect->floor, &sect->ceil, &n);
//Ignore the '#' and the 'x' below, they represent something not used in map-clear txt (a simpler version of the real file)
for(m=0; sscanf(ptr+=n, "%32s%n", word, &n) == 1 && word[0] != '#'; )
{
num = realloc(num, ++m * sizeof(*num)); num[m-1] = word[0]=='x' ? -1 : atoi(word);
/* Upon extiting num should be allocated to sizeof(int) * m bytes of space */
}
sect->npoints = m /= 2;
sect->neighbors = malloc( (m ) * sizeof(*sect->neighbors));
sect->vertex = malloc( (m+1)* sizeof(*sect->vertex));
->>>>>!!! for(n=0;n<m;++n) sect->neighbors[n] = num[m + n]; /* Shouldn't this be out of bounds, since
num is only allocated to m elements?
This seems to start from the end of the array
and go over, never touching the beginning.
(specifically it assumes num is of
m*2 size but I don't see how that could be)
*/
for(n=0; n<m; ++n) sect->vertex[n+1] = vert[num[n]]; /* This one goes from 0 to n, why the
hell does the above work? */

How does that work? Am I being an idiot?
>>
File: 1422331360809.png (49KB, 744x612px) Image search: [iqdb] [SauceNao] [Google]
1422331360809.png
49KB, 744x612px
>>47032959
>>
Any good books, or blogs on software testing?
>>
>>47037237
How is this different from responding to PING request or writing a message to the channel?
The bot checks if the string is in the line it received from the server, and if it is it sends the corresponding line.

I suggest you let the bot print every line it receives from the server and then type shit in the channel for a while, just to see how IRC commands work, or search all the available commands.
>>
>>47037370
It might go out of bounds and not crash, run it under valgrind.
>>
File: 1366280347616.jpg (5KB, 119x164px) Image search: [iqdb] [SauceNao] [Google]
1366280347616.jpg
5KB, 119x164px
>>47037237
I don't know how to say this, but you need to completely go back to the drawing board, firstly learn how sockets work.
>>
>>47037370
Wait I left out some critical information.
     //Looks like sector 0 20     3 14 29 49         -1 1 11 22
//in map-clear.txt
sectors = realloc(sectors, ++NumSectors * sizeof(*sectors));
struct sector* sect = &sectors[NumSectors-1];

The declaration of sector looks like this in the map-clear.txt file this function is reading.
I guess the m just represents the vertices and the neighbors (-1 1 11 22) are represented by m + offset? But I still don't understand why that works because the for function should have read the neighbors too so m should be 8 in the example
sector 0 20    3 14 29 49 -1 1 11 22

so if I did m + n I should still go past the bounds of the array for n right?
What the fuck?
>>47037497
Valgrind says 0 errors from 0 contexts and it crashes if I change it any way I've tried.
>>
>>47037359

>x+7
>>
File: javascript.jpg (15KB, 269x321px) Image search: [iqdb] [SauceNao] [Google]
javascript.jpg
15KB, 269x321px
>>47037429
Bamp
>>
>>47037558
Now do PHP.
>>
>>47037370
>m /= 2
Halves m.
>>
>>47037485

if (charSearch(buf,"hi scooby")) {
sendData("PRIVMSG #niggersack :hows it going\r\n");
}


Doesn't work. This error is returned

[email protected]:~# g++ -w main.cpp -o main
main.cpp: In function 'int main(int, const char**)':
main.cpp:124:63: error: too few arguments to function 'bool sendRawPacket(char*, int)'
sendRawPacket("PRIVMSG #niggersack :hows it going\r\n");
^
main.cpp:14:6: note: declared here
bool sendRawPacket(char *msg, int sockfd){
^
[email protected]:~#



>>47037499

No thanks.
>>
File: skeleton explosion.gif (952KB, 500x197px) Image search: [iqdb] [SauceNao] [Google]
skeleton explosion.gif
952KB, 500x197px
>>47037621
Goddammit gg.
>>
>>47037623
Why are you root?
>>
>>47037623
Read the error?
>too few arguments
it isn't cryptic in any way.
sendRawPacket("blah", sockfd);
>>
>>47037645

Problem was fixed by including sockfd.

The bot successfully connects to the channel but when I say "hi scooby". Nothing returns

if (charSearch(buf,"hi scooby")) {
sendRawPacket("PRIVMSG #niggersack :watch it fag\r\n", sockfd);
}


[email protected] PRIVMSG #niggersack :hi scooby


That's whats in the console. So it sees the message but doesn't reply for some reason.
>>
File: php.jpg (121KB, 1436x856px) Image search: [iqdb] [SauceNao] [Google]
php.jpg
121KB, 1436x856px
>>47037602
too lazy to do all the tests
>>
>>47037645
Probably a haxor liveUSB?
>>
>>47037714

It's a dedi I'm logging to and it's a saved session so I don't have to type in the host name everytime. :~)
>>
>>47037723
>Logging into your dedi as root
>ever
>>
Anyone know anything about Vim want to talk about whats in their vimrc file?

set nocompatible              " be iMproved, required
filetype off " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Avoid a name conflict with L9
Plugin 'user/L9', {'name': 'newL9'}

" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line


Is what vundle starts you with going to pull the plugins I dont want out of it now.
>>
File: 1420434983725.gif (3MB, 460x306px) Image search: [iqdb] [SauceNao] [Google]
1420434983725.gif
3MB, 460x306px
>>47037558
anyone do software testing?
>>
>>47037729

>giving a shit about a junk dedi

it's literally just for development. i have nothing useful on it.
>>
>tfw I don't think in traditional OOP anymore
kek, thank you Go
>>
>>47037811
Go shill detected
>>
>>47037687

a-anyone?

>>47037669

see
>>
>>47037811
>tfw I think only in cache friendly code now with C/C++

I only really use sepples now for namespaces
>>
>>47031905
>>>/loper-os/
>>>/cat-v/

dont come back
>>
>>47037687

Weird how this doesn't work. It literally makes total sense to work. If it receives the word "hi scooby", it sends a packet to #niggersack saying "watch is fag". Makes absolutely no sense.
>>
File: 1425360871826.gif (311KB, 500x559px) Image search: [iqdb] [SauceNao] [Google]
1425360871826.gif
311KB, 500x559px
Not sure what I'm doing wrong.. Cant figure out this loop

import java.util.Scanner;

public class CurrencyBankTester {

public static void main(String[] args) {


double money= 0;
double dollar=0;
double euro=0;
double yen=0;
String currency;
char c;

CurrencyBank curbank = new CurrencyBank();


Scanner in = new Scanner(System.in);
System.out.println("Welcome to the CurrencyBankTester! ");
System.out.println("What type of currency to add (Y, E, D or X to exit)?");
currency = in.next();
c= currency.charAt(0);
c= Character.toUpperCase(c);

while (c !='X'){




System.out.println("What value do you wish to add?");
money = in.nextDouble();




if (currency.equals("Y"))
{
money=yen;
curbank.AddYen(yen);
}
else if (currency.equals("E"))
{
money=euro;
curbank.AddYen(euro);
}
else if (currency.equals("D"))
{
money=dollar;
curbank.AddYen(dollar);
}
System.out.println("What type of currency to add (Y, E, D or X to exit)?");
currency = in.next();
c= currency.charAt(0);
c= Character.toUpperCase(c);

}//end while

System.out.println(curbank.CountMoney());


}

}
>>
>>47038131
Can you be more specific? Are you saying you are stuck inside the while loop? Does the program always ask the user to input something or does it go dead?
>>
>http://stackoverflow.com/questions/22591544/performance-advantages-of-an-array-of-function-pointer-over-if-blocks
interdasting if anyone of you guys is still curious about my poopy way of avoiding branching

>Some pretty confused code coming from the OP, however I approve of the general advice to favour virtual functions
>A cache miss results in 250% penalty of performance on an arm processor. Safer to say that a good practice is to avoid if statments if possible
>>
What am I doing wrong here?
>>
File: 1424930408051.gif (495KB, 920x673px) Image search: [iqdb] [SauceNao] [Google]
1424930408051.gif
495KB, 920x673px
>>47038330
Its going through the loop but the System.out.println(curbank.CountMoney());
prints 0.0

this is the other class

public class CurrencyBank {

double dollar=0;
double euro=0;
double yen=0;

public CurrencyBank()
{

}

public double countMoney()
{
dollar += (yen * 0.0084);
dollar += (euro * 1.13);
return dollar;
}

public void addDollar(double dollar)
{
this.dollar+=dollar;
}

public void addEuro(double euro)
{
this.euro+=euro;
}

public void addYen(double yen)
{
this.yen+=yen;
}


//end of program
}
perhaps I miss worded,
I cant figure out why the return value keeps showing up zeros
>>
>>47038411
try printing out different variables in different parts of the program and see which value doesn't match your expectation.
>>
if (charSearch(buf, "hey")) {
sendRawPacket("PRIVMSG #niggersack :hey there!\r\n", sockfd);
}


I need to parse the PRIVMSG string sent to the channel or directly to the bot for the user nick, parse the message to see if it contains ".help", and if it does, send back a raw PRIVMSG command to that nick with the list of commands as the message string.

How would I do this?
>>
>>47038573

So i'd have to parse 'userid', and 'PRIVMSG' to see that it's a channel message. Channel isn't really relevant, but the message at the end would be, because I have to parse this to see if it matches ".help"
>>
>>47038573
The ".help" needs to be at the start in the string or could be anywhere within?
>>
>>47038131
Look at this part carefully. Firstly, you're calling addYen everywhere instead of the proper currency. Secondly, you read the user input into "money" and right before the add method, you immediately overwrite it.

money = in.nextDouble();


if (currency.equals("Y")) {
money = yen;
curbank.addYen(yen);
} else if (currency.equals("E")) {
money = euro;
curbank.addYen(euro);
} else if (currency.equals("D")) {
money = dollar;
curbank.addYen(dollar);
}
>>
>>47038595

The start
>>
Im sure this is a pretty basic fix for you guys, but I'm not sure what im doing wrong.
 

switch (word)
{

case 'a' :
case 'A' : cout << "Alpha ";

case 'b' :
case 'B' : cout << "Bravo ";

case 'c' :
case 'C' : cout << "Charlie ";

case 'd' :
case 'D' : cout << "Delta ";

case 'e' :
case 'E' : cout << "Echo ";

case 'f' :
case 'F' : cout << "Foxtrot ";


case 'g' :
case 'G' : cout << "Golf ";

case 'h' :
case 'H' : cout << "Hotel ";

}


The breaks arent there, but when I was putting them in, i would get only the first value. Without them, I get all of them. I want one for each letter entered.
>>
>>47038609
Then mantain an array of pointer to string, then compare that string with every element of the array using strncmp(), if returns 0 you have found that command.
>>
>>47038613
Then you need to call the switch for each character in word, not on the whole word.
>>
>>47038613
What is the data type of "word"? It should probably be called "letter" or "c". Otherwise, it sounds like a String.
>>
>>47038613
I think you just need to put 'break;' every 2 cases

And that's assuming 'word' in the variables is only a character variable.
If it's a string, just separate it into individual letters and then pass each through the switch in a loop.
>>
>>47038659
char.

Basically, if I type in kek, I would get a word for each first letter of each word.


>>47038656
I'm sorry, what would that look like?
>>
>>47038633

Something like this?

if(!strncmp(buf, ".help", 4)){
sendRawPacket("PRIVMSG #niggersack :hey there!\r\n", sockfd);
}
>>
>>47038670
Same poster here. This book is kind of bad. I never really feel prepared to do my assignments for this class. The examples have been less than helpful.
>>
>>47038411
Anon, look at your code. You are telling the scanner to store whatever value you type into the variable "money". Then it gets overridden with 0 (regardless if Yen, Euro or Dollar) and you add the 0 to the total pile. Am I making sense?
>>
>>47038674
Yeah, a pointer to array of string would be nice if you need to "detect" a lot of commands.
>>
>>47038700

Weird.

The bot connects and says "hey there!" instantly when this happens and doesn't respond to ".help" by me.
>>
>>47038670
Using a for (each) loop:
#include <iostream>

using namespace std;

int main()
{
string word;
cin >> word;

for (char c : word)
switch (c) {
case 'a':
case 'A': cout << "Alpha "; break;

case 'b':
case 'B': cout << "Bravo "; break;

case 'c':
case 'C': cout << "Charlie "; break;

/* ... */
}

cout << endl;
}


http://ideone.com/UZUib9
>>
>>47038709
Maybe because it starts comparing at the address of buf, and the third argument for strncmp should be 5.
>>
>>47038751

Could you show me what to do? Sorry for sounding so stupid. I'm not that well at understanding concepts over text.
>>
>>47038748
And this isnt really explained in the examples. This is tiresome.

Mind giving a little explanation?
>>
>>47038603
I just figured that out and came back to thank you guys. I can t believe I skipped over it. :)
>>
>>47038828

The string "word" is set to the switch of (c), you get your input taken and its assigned to "word" and if the case is 'a' then it'll equal "Alpha". etc.
>>
>>47038804
I don't know IRC bots m8, but if buf is some string obtained for example user input:
Enter input: ".help pls" // this is saved on buf

Then using
strncmp(buf, ".help", 5); // 5 because .help is 5 characters long

Should return 0, negate that to execute the if.
>>
File: PlatosCave.gif (54KB, 600x330px) Image search: [iqdb] [SauceNao] [Google]
PlatosCave.gif
54KB, 600x330px
>>47038845
Ok I see now. I didnt know of the switch (c)
>>
>>47038131
How many threads are you shitposting this on?
>>
>>47035797
>Criticize people for "selling out" or "being a hack" for programming in anything but C
>Submits coursework in Python
>Prerequisites explicitly states Scheme and Java are strongly preferred
>Regularly discusses shit like "Lets be the first people to write a glNext game engine, we'll earn a fortune!"
Average day in CS.
>>
>>47039067
>Scheme

Stopped reading.
>>
>>47039067
I wish I was taught C properly. I've had one course on it and the rest are microcontroller programming.

I still have no idea how to do make files or link/make libraries
>>
>>47039087
Scheme is still popular for teaching data structures. What's the problem?
>>
>>47039117
>What's the problem?

It's a shit.
>>
>>47039123
>>
>>47039123
Says the tripfag
>>
>>47039103
Haven't got to microcontroller programming yet, I suspect it's gonna be in Matlab.
>>
>>47039158
I dont think you can use matlab for microcontrollers, or rather you shouldn't.
>>
What's a good place to put all my libraries and compiled things in Windows. I feel like I'm clogging C:/ directory, I have a bunch of OpenGl context libraries compiled, boost, ant, ijmage processing libraries, misc. All on C:/ in their respective directories.
>>
>>47039184
C:/cp/
(Stands for computer programs).
>>
I don't know how to code at all, but I'm trying to make this simple Python script to control my media player with my Wiimote.

 
keyboard.setKey( Key.Alt, and Key.Equals, wiimote[0].buttons.button_down(WiimoteButtons.DPadRight) )


I stole most of the structure from another code. I don't know how to set two keys for the same button so I just assumed "and" would join them, but it doesn't work so could anybody tell me how to join "Key.Alt" and "Key.Equals" in there?
>>
>>47039178
You can on the more powerful microcontrollers and through a serial port, they've also got a Matlab to C compiler thing.
>>
>>47039233
I don't know what you're using there, but try doing it in 2 lines:
keyboard.setKey( Key.Alt, wiimote[0].buttons.button_down(WiimoteButtons.DPadRight) )
keyboard.setKey( Key.Equals, wiimote[0].buttons.button_down(WiimoteButtons.DPadRight) )
>>
So I'm learning abut trees in my data structures class and am trying to make a class for it. I keep getting this compiler error and I dont know how I'm getting it.
└[~/school/data_structures-CS2250/proj2]$make
g++ -c -std=c++11 -Wall -pedantic main.cpp -o main.o
In file included from main.cpp:2:0:
main.h:11:8: error: invalid use of non-static data member ‘intTree::root’
node *root;
^
main.h:20:37: error: from this location
bool intTree::grow(int a, node* b = root){
^
main.h:11:8: error: invalid use of non-static data member ‘intTree::root’
node *root;
^
main.h:48:41: error: from this location
void intTree::view(int a = 0, node* b = root){
^
Makefile:13: recipe for target 'main.o' failed
make: *** [main.o] Error 1

Here is the code, I'm still working on it so its not finished but it should work if I can fix this compiler error.
http://pastebin.com/DzTHF9Ls
>>
File: wiim.jpg (21KB, 390x332px) Image search: [iqdb] [SauceNao] [Google]
wiim.jpg
21KB, 390x332px
Actually here's the entire code, if anybody sees something off here (I don't know what any of this shit means) please help.

def wiimoteButtonUpdates ():

#Volume
keyboard.setKey( Key.Alt, Key.Equals, wiimote[0].buttons.button_down(WiimoteButtons.DPadRight) )
keyboard.setKey( Key.Alt, Key.Minus, wiimote[0].buttons.button_down(WiimoteButtons.DPadLeft) )

#Timeline
keyboard.setKey( Key.LeftArrow, wiimote[0].buttons.button_down(WiimoteButtons.DPadUp) )
keyboard.setKey( Key.RightArrow, wiimote[0].buttons.button_down(WiimoteButtons.DPadDown) )
keyboard.setKey( Key.Space, wiimote[0].buttons.button_down(WiimoteButtons.One) )

#Time
keyboard.setKey( Key.Enter, wiimote[0].buttons.button_down(WiimoteButtons.B) )
keyboard.setKey( Key.Alt, Key.Ctrl, wiimote[0].buttons.button_down(WiimoteButtons.Home) )

#Frames
keyboard.setKey( Key.Ctrl, Key.E wiimote[0].buttons.button_down(WiimoteButtons.Two) )
keyboard.setKey( Key.Ctrl, Key.A wiimote[0].buttons.button_down(WiimoteButtons.A) )

#Subtitles
keyboard.setKey( Key.Alt, Key.H wiimote[0].buttons.button_down(WiimoteButtons.Minus) )

if starting:
system.setThreadTiming(TimingTypes.HighresSystemTimer)
system.threadExecutionInterval = 2
wiimote[0].buttons.update += wiimoteButtonUpdates


>>47039276
Good idea! I'm using FreePIE. Now I'm getting "unexpected token 'wiimote'"...
>>
>>47039305
I don't think you can do that kind of thing in function declarations.

Why are you even putting that as an argument and not just assigning the global variable within the function? or just passing it normally?
>>
>>47039362
What do you mean?
>>
>>47039325
Paste the whole error message.
>>
>>47039406
instead of saying node* b = root why not just node* b?
>>
File: Wiimscript.jpg (242KB, 1360x768px) Image search: [iqdb] [SauceNao] [Google]
Wiimscript.jpg
242KB, 1360x768px
>>47039413
Sadly that's it...
>>
>>47039435
Because I'm using the function recursively. Did you look at the pastbin?
bool intTree::grow(int a, node* b = root){
if (b == nullptr){
node* nNode = nullptr;
nNode = new node;
if (nNode == nullptr) {return false;}
nNode->data = a;
nNode->count = 1;
nNode->left = nNode->right = nullptr;
return true;
}
else if (a == b->data){
b->count++;
return true;
}
else if (a < b->data)
grow(a,b->left);
else
grow(a,b->right);
//should not reach this
std::cout << "ERROR" << std::endl;
return false;
}
>>
>>47039473
I did, but that doesn't mean you should be doing that at all, all it looks like you're doing is overwriting b with root every call
>>
>>47039500
Hmm, maybe I'm not understanding pointers completely then. If I did node* b = root, does b not point to the data that root is pointing to?
So in the first call (tree.grow(1)) b would essentially be root, but in the recursive calls b would be the left or right branches.
>>
>>47039577
If you think that b is assigned the data root is pointing to in the first call, why not in the recursive call as well?

try deleting the = root and call it with root instead and see if it works

grow(1, root)
>>
>>47039446
Try changing the last line with this, just to hopefully get more details on the error:
   try:
wiimote[0].buttons.update += wiimoteButtonUpdates
except Exception, e:
print e
>>
If you wrote a function that changes the state of multiple GUI controls then what would you name the function?
>>
>>47039611
No luck. I tried removing the entire if starting: paragraph and still the same thing. I'm asking about it on the forums of FreePIE so hopefully I'll get an answer about it in the next days...
>>
>>47039607
So Ive tried that and now I'm getting this.
└[~/school/data_structures-CS2250/proj2]$make
g++ -c -std=c++11 -Wall -pedantic main.cpp -o main.o
In file included from main.cpp:2:0:
main.h:49:6: error: default argument missing for parameter 2 of ‘void intTree::view(int, intTree::node*)’
void intTree::view(int a = 0, node* b){
^
Makefile:13: recipe for target 'main.o' failed
make: *** [main.o] Error 1


What I dont understand is, in the code before, why I was getting "invalid use of non-static data member ‘intTree::root’".
>>
>>47039700
Yeah, please ignore me. just put static before node* root. Its been a while since I used c++
>>
>>47039757
If I do that wouldn't I just get one root and not a root for each instance of the intTree class? What am I doing that root needs to be static?
Also Ive tied that and got this:
└[~/school/data_structures-CS2250/proj2]$make
g++ -c -std=c++11 -Wall -pedantic main.cpp -o main.o
g++ main.o -o _main
main.o: In function `main':
main.cpp:(.text+0x278): undefined reference to `intTree::root'
main.o: In function `intTree::intTree()':
main.cpp:(.text._ZN7intTreeC2Ev[_ZN7intTreeC5Ev]+0xb): undefined reference to `intTree::root'
collect2: error: ld returned 1 exit status
Makefile:10: recipe for target 'all' failed
make: *** [all] Error 1
>>
>>47036373
>in Python it's just a tacked on library
Because that's all it needs to be.
>>
File: talkToHorses.png (618KB, 700x605px) Image search: [iqdb] [SauceNao] [Google]
talkToHorses.png
618KB, 700x605px
>>47036628
>>47036672
>>47036646
What is this, the "I enjoy proprietary software which has crappy Visual Basic features tacked on" club?
Fight me.
>>
File: 1423938584943.png (177KB, 1920x1080px) Image search: [iqdb] [SauceNao] [Google]
1423938584943.png
177KB, 1920x1080px
>>
>>47039184
Why don't you make a libraries or code directory.
>>
has anyone ever used git-encrypt?
>>
>>47039305
You should not be passing around member root anyway, but it isn't valid because, at compile time, there is no way to guaranteed that root will exist. If root were a static member, it would be valid.

My suggestions:
http://pastebin.com/K3eXSKs7
>>
>>47039835
>If I do that wouldn't I just get one root and not a root for each instance of the intTree class
Yes, so don't.

>What am I doing that root needs to be static?
You are attempting to pass it as a default parameter.

>>47039700
>So Ive tried that and now I'm getting this.
A default argument can only be specified after all parameters that have no defaults.

In other words, any parameter to the right of a parameter with defaults must also have defaults.

Also, this:
>>47040269
>>
>>47040052

roooooollllll
>>
someone yesterday asked about what callbacks were, and I gave an example.

for anyone else wondering, here is the example with comments, somewhat polished.

  //normally you do some blocking operations in here
// ...
// ...

//in node.js you would call your "callback" with process.nexttick();
//this sticks your callback on top of the queue, allowing other operations
//in the event loop to execute while you do your blocking stuff.
callback(10, 0); //executes the function passed to callback with args (10,0)
}

//calls coolThingsToDo with argument doingThings(j ,k)
//if you pass in some result of your blocking operation to your function
//you can now do work on it asyncronously, super awesome for parsing database
//requests or assets on disk.
coolThingsToDo(function doingThings(j, k){
if (k <= j){
doingThings(j, k + 1) // doing things executes recursively until k = 10
console.log(k);
} else {
//the reason "CountDown!" is printed first has nothing to do with callback
//and instead is a result of the eecution order of the recursive function
console.log("CountDown!");
}
});
>>
>>47031905
Why don't you work on THIS?
*unzips dick*
>>
>>47031276
>Learning programming to genuinely fund the other things I want to do
>At the same time enjoy it even though I suck at it
>Nobody here tells me how to get better or what mistakes I make to look out for
>Just call my code shit

Just reminding you that you're all faggots
>>
>>47040517
now if only I can copy / paste correctly
function coolThingsToDo(callback){
//normally you do some blocking operations in here
// ...
// ...

//in node.js you would call your "callback" with process.nexttick();
//this sticks your callback on top of the queue, allowing other operations
//in the event loop to execute while you do your blocking stuff.
callback(10, 0); //executes the function passed to callback with args (10,0)
}

//calls coolThingsToDo with argument doingThings(j ,k)
//if you pass in some result of your blocking operation to your function
//you can now do work on it asyncronously, super awesome for parsing database
//requests or assets on disk.
coolThingsToDo(function doingThings(j, k){
if (k <= j){
doingThings(j, k + 1) // doing things executes recursively until k = 10
console.log(k);
} else {
//the reason "CountDown!" is printed first has nothing to do with callback
//and instead is a result of the eecution order of the recursive function
console.log("CountDown!");
}
});
>>
>>47040544
Well, maybe you should stop writing shit code
>>
>>47040572
Then explain how its shit. That's like telling a cook
>Your cooking is shit
They know its shit. Then tell them how to improve instead of twiddling around with your thumb up your ass
>>
>>47040589
Maybe if someone asks for criticism, but if someone just posts some shitty code, I'm going to call it shit.
>>
>>47040589
it takes too much human capital to invest in anon like that.

we arnt your teacher / professor nor your mentor or even your boss.
if you have a specific question, it may get answered. but there is no value to anyone here in diagnosing why you are bad.

you need to provide value, and you will get value back. congratulations, you are now an adult.
>>
>>47040634
Then you'll just keep being some smug unfunny le cs grad circlejerking cancer

>>47040653
>It takes too much effort to invest in someone
>Implying everyone has access to those resources

So you're telling me its too hard for an experienced coder to take one look at someone whos new to it all for one second, and see what they could improve on. Or even offer general generic advice.
>>
>>47040697
Helping the competition is frowned upon. You can always pick a book or get a tutor.
>>
>>47040697
>Or even offer general generic advice.

my general generic advice for the day is, use the google.
>>
>>47040697
>People are obligated to help you
>Implying that it isn't a lot of effort to understand a chunk of code, especially one that has shit structure

>general generic advice
"Learn C and a RISC assembly"
>>
>>47040737
first project: tornado.
>>
>>47040737
Never said anyone was obligated, but whenever someone obviously new posts and all of a sudden its
>Wow look at how shit this is
To try and laugh some poor faggot out. I'm not saying to go full hugbox but holy shit there's a reason people don't like you

>>47040716
>>47040717
Those three are pretty much the basics of how anyone gets started, but its practically right.
>>
File: abstractSheckle.jpg (7KB, 208x243px) Image search: [iqdb] [SauceNao] [Google]
abstractSheckle.jpg
7KB, 208x243px
>>47040716
>can't into coöperatition
>>
New Thread:
>>47040809
>>47040809
>>47040809
>>
>>47031555
ew angular
Thread posts: 324
Thread images: 43


[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]
Please support this website by donating Bitcoins to 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
If a post contains copyrighted or illegal content, please click on that post's [Report] button and fill out a post removal request
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 4Archive shows an archive of their content. If you need information for a Poster - contact them.