[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread

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

Thread replies: 255
Thread images: 36
File: himegoto.webm (3 MB, 720x405) Image search: [Google]
himegoto.webm
3 MB, 720x405
old thread: >>53517629

What are you working on, /g/?
>>
First for Java is the number one programming language
>>
Can one of you guys explain me this? (in C)

"signed char" goes from -128 to 127 and we use the positive values for the ASCII code. There's a program where I need a special sign from the ANSI code but the value is higher than 127 (lets assume it's ยต with 181), so why does the program works with "char", but not with "unsigned char" (which goes from 0 to 255). I don't get it.
>>
>java
lmao
>>
>>53523958
She's pretty cute
>>
>>53523960
>in C
>"signed char" goes from -128 to 127
no, it goes from SCHAR_MIN to SCHAR_MAX
>"unsigned char" (which goes from 0 to 255)
no, it goes from 0 to UCHAR_MAX
>>
>>53524012
not this faggot bullshit again
>>
>C
lmao
>>
Anyone here know a lot about multithreading with C++?

Trying to make a UI library that supports asynchronous rendering.
>>
>>53524033
>I'm a webshit
please go to /wdg/
>>
>>53524012
You mean CHAR_MIN to CHAR_MAX?
That doesn't help me either.
>>
>>53524058
no, CHAR_MIN to CHAR_MAX is the range for "char"
>>
>your favourite language
lmao
>>
>>53524047
>Consistently being this much of a faggot that you're immediately identifiable on an anonymous image board.
anon...
>>
File: princess.jpg (60 KB, 602x824) Image search: [Google]
princess.jpg
60 KB, 602x824
>>53523989
>>
>>53524088
>I'm not a programmer but I like animu
lad...
>>
>>53524099
I only like 2d futa traps who program
>>
>>53524084
lol, $other_language fag. Can't understand $favourite language? Kill yourself, $other_language is slow as shit and badly designed
>>
>>53524121
>futa trap
what
>>
>lmao
mate...
>>
>>53524140
>mate
kek...
>>
>>53524140
>mate
anon..
>>
>>53524155
>anon
dude...
>>
Why are Indians the best programmers
>>
>>53524168
>dude
I...
>>
>>53524178
>l
.I.
>>
File: 1454884458436.jpg (69 KB, 540x540) Image search: [Google]
1454884458436.jpg
69 KB, 540x540
>tfw fell for the java meme
>>
Write a function that swaps two variables in Java
>>
>>53524186
>.I.
person...
>>
>>53524201
You can't do that Java has no pointers
>>
File: trace.png (10 KB, 500x500) Image search: [Google]
trace.png
10 KB, 500x500
>tfw raytracer improves with each passing hour
>>
>>53524243
P H O N G
H
O
N
G
>>
>>53524201
You can't do that Java has no functions
>>
>>53524253
>I'm a retard
>>
Let's define a parameter of number n as the least common multiple (LCM) of the sum of its digits and their product.

Calculate the parameter of the given number n.

Example:

parameter(1) = 1
parameter(22) = 4
Both the sum and the product of digits equal 4, and LCM(4, 4) = 4.
>>
>>53524201
void swap(int a, int b)
{
int temp = a;
a = b;
b = temp;
// a and b are copies of the original values.
// The changes we made here won't be visible to the caller.
}
>>
>>53524201
you can't do that Java has no variables
>>
>>53524201
you can't do that Java is good for nothing
>>
>>53524309
>>53524263
>>53524221
my favorite meme
>>
>>53524304
>not a function
try harder
>>
>>53524325
suck my dick, will ya?
>>
>>53524355
I won't, thanks, but why are you here if you don't know anything about programming?
>>
I can't tell if I enjoy /dpt/ or /agdg/ more
>>
>>53523960
The way the program will represent mu is entirely implementation dependent. If we go through reasonable guesses, that is that 181 comes from an iso norm that looks like latin1, and that your signed chars are 8bits 2-complement integers, here's my reasoning:
greek1 defines that mu is encoded as 0xB5, which is 181 in decimal.
it's put as is in a char.
This makes the -75 signed value.

Try it!
>>
>>53524378
>know anything about programming?
nigga that's a function. in C.
>>
I heard that switch statements are 10,000,000 times faster than if statements in some situations. Is this true? Why?
>>
>>53524433
>I don't even know that C is not Java.
Please, just go already.
>>
>>53524450
No. Because it's false.
>>
I'm learning java because of android.
>>
>>53524484
What does this even mean? You can write code for any platform using any language if a compiler can compile to it
>>
>>53524484
Implying you can compete with the millions of Indians already flooding the Android market with their shitty apps
>>
>>53524450
Yes, it's true.
Think about it. A switch is just switched to the proper output, where as an 'if' requires thought. Is that number 5? Hm, I dunno. Oh, it is!
Significantly more time taken.

Source: Enterprise java developer and entrepreneur of Self-Suck Ltd.
>>
>>53524457
stay mad faggot
public static int madFaggot(int a, int trash)
{
return a;
}

public static void main(String[] args)
{
int a = 10;
int b = 20;

a = madFaggot(b, b = a);
}
>>
Why do Java exceptions work like they do? I've just been doing "try/catch" statements (never using throws) so guess I'm missing something but shit just feels cumbersome
>>
>>53524515
switch also has to compare the input to it's entire list of enumerated values until it encounters a break.
worst case is comparing through every single enum and then doing default.
>>
>>53524527
would a be 10 or 20?
>>
>>53524072
Epic newfag trolling or am I too stupid for this? My book says that we use only the positive values from the char range, so why do I have to use char (which goes max to 127 for the positive values), although ยต has the (higher) value 181.
The only way to solve this would be the use of unsigned char, but the program doesn't work then with it.
>>
>>53524527
>still not functions
Will they ever learn?
>>
Do any languages have any built in stack functions?
>>
I want to make money programming which language should I learn to make the most amount of cash the fastest and what platform?
>>
>>53524581
java.util.Stack, nigga
>>
>>53524594
memejs on the web platform
>>
>>53524553
No, switch is magic. It instantly goes to the correct one. If it doesn't exist it just shrugs.
>>
Starting on a Java project for school and Eclipse is giving me this.
Can someone tell me fix this please?
>>
>>53524639
install gentoo
>>
>>53524639
Fix this please.
>>
>>53524639
>Java
Found your problem
>>
>>53524562
a would be 20
>>
>>53524639
You have to set the class variable on your system for your JRE just google the error it's literally that easy
>>
>>53524578
here's your reply fucboi
>>
>>53524639
The problem is that you have an unbound classpath container called 'JRE System Library [JavaSE-1.8]' in your project, and the project cannot be built until build path errors are resolved.
You can thank me later.
>>
>>53524693
a what would be 20?
>>
>>53524718
a
>>
>>53524708
>so mad
:^*)
>>
>>53524659
I plan to.
>>53524661
>>53524678
>>53524696
Nevermind. I got it. If anyone is wondering:
>Project + Properties + Java Build Path
>Select Libraries tab
>Select the troublesome JRE entry
>Click Edit button
>Choose an alternate JRE
>Click Finish

Fuck Eclipse.
>>
MEMORY
O
D
E
L
>>
>>53524737
this shit passed QA?
>>
Why people hate java so much? It is good language to learn.
>>
>>53524639
Don't use an IDE
>>
>>53524639
1. Uninstall Eclipse and use IDEA.
2. Google your error.
>>
>>53524773
lmao
>>
>>53524777
My professor said we had to use or we would fail the course.
>>
>>53524012
Kill yourself.
>>
>>53524803
Professional Java faggot here don't listen to these homosex Netbeans and Eclipse are the industry standard
>>
>>53524773
To feel superior for using language X, not realizing that every language has it's purpose. Source: Java, C, and C++ dev.
>>
>java
lmao
>>
>>53524817
xD
>>
>>53524803

Then use IntelliJ IDEA instead. Unless you enjoy pain.
>>
>>53524567
What character encoding just so I know? Also see >>53524404 : signed char still has 256 possible values, just like unsigned char, so it's arbitrary at this point, as long as -75 (or something else) is always recognised as ฮผ and the other values never are.

ฮšฮฑฮปฮทฮผฮญฯฮฑ ฮšฯŒฯƒฮผฮต !
>>
>>53524850
Kalispera re :D
>>
>>53524849
>>53524821
He said: "don't listen those faggots on /g/"
>>
>>53524846
Stop spamming.
>>
>>53524803
iktf anon
My professor required us to use BlueJ.
Of all the IDEs out there, fucking BlueJ.
>>
>>53524553
You're retarded.
Kill yourself.
>>
>>53524567
Addendum: ascii only uses 128 values, keeping the 8th bit at 0. Widespread unicode encoding use the negative values, those with that bit at one, for the non-ascii characters they bring.
>>
>>53524893
I meant pre-unicode encodings, perdรฒn!
>>
I have a degree, side-projects, and a nice website. Is it okay to lie about programming experience? I was thinking about saying I've done freelance stuff when I haven't
>>
The programming literacy of /dpt/ is unbelievable.
Go read a fucking book sometime, or just kill yourselves.
>>
>>53524907
Yes. Lie your ass off. Everyone who's interviewing you did the same to get their position.
>>
>>53524929
i never lied in an interview. But lying about freelance isn't a big deal. just so long as you don't get caught out.
>>
>>53524929
>lied about my experience
>now sysadmin for research company
>if something breaks they will expect me to fix it, I have no idea what I'm doing
I'm afraid to go to work.
>>
How do I paste code? 4chan says the code is pretty long.
>>
>>53525056
pastebin
>>
>>53525056
pastebin and other sites?
>>
>>53525041
just install adobe reader
>>
>>53525056
4chan posts have a 2000 character limit.
>>
>>53524581
Forth or most assembly languages
>>
>>53525072
>>53525068
Ah. Thought I could paste directly here.

Anyway guys, I tried to do a flappy-birdish thing with termbox. Run in urxvt(other terminals suck) and edit the code if you want - like line 216 for the tick time, currently it's 40ms (and the pillars for example are not quite intelligently lenghthened). Use
`go get github.com/nsf/termbox-go` to install the termbox package first.

http://paste.debian.net/416098/
>>
File: XYLwHpM.webm (387 KB, 426x426) Image search: [Google]
XYLwHpM.webm
387 KB, 426x426
>when you program in racket
>>
>Tfw coding anything good requires so much coding and work

What is the point
>>
>>53525247
>get boner
>can't focus on programming because boner
>masturbate
>lose all desire to program
>>
>>53525246
Why would you program in racket
>>
>>53525246
>tfw iktf
>>
File: jcracket.png (514 KB, 1680x1050) Image search: [Google]
jcracket.png
514 KB, 1680x1050
>>53525333
why not ?
>>
>>53525372
You answer first.
>>
>>53524404
>>53524850
>>53524893
Thanks guys. Now I understand it.
It's the German letter "รค", but ยต was funny and everyone knows it.
>>
Python question:
Is there a way to access a cookie directly from a http.cookiejar.CookieJar? I don't want to iterate though the whole thing, but rather just get a cookie directly. It doesn't support indexing nor is it subscriptable.
>>
>>53525498
create your own object extending the object that supports indexing
or just iterate through it desu
>>
Coming from java, learning C++. So here is the thing. I liked to write the "path" to my methods and constants etc. Like:
MyClass.CONSTANT_XY and MyClass.method1().

instead of just CONSTANT_XY or just method1()

Im using SDL2, so here is a method called SDL_CreateWindow(params), but i actually want to use SDL::SDL_CreateWindow(params) or something like that.
>>
>>53525575

SDL is written in C. C does not have namespaces which is the reason libraries use the Libname_* convention to prevent name collision.
>>
>>53525542

Yeah, I settled for just iterating through it once and adding them to a dictionary. It's still weird that the CookieJar class doesn't support at least indexing.
>>
Anyone doing some Vulkan here? Can I pack two pipeline barriers into one command buffer and bind a render pass between them?
>>
I keep teaching myself C++ but I'm getting burnt out because I don't know what to do with all the information. What do?
>>
>>53525575
>but i actually want to use SDL::SDL_CreateWindow(params) or something like that.
literally why?
>>
>>53524294
 import java.util.ArrayList;
import java.util.Scanner;

public class LCM {
public static void main (String args[]){
while(true){
Scanner scanner = new Scanner(System.in);
System.out.println("Enter a two digit number!");
String number = scanner.next();
if (parameter(number)[1]!=0){
System.out.println("LCM is:");
System.out.println(lcm(parameter(number)));
}else {
System.out.println("One, or more, of the digits are zero!");
}

}
}
static int [] parameter(String number){
int sum = 0;
int product = 1;
for(char c: number.toCharArray()){
sum += Character.getNumericValue(c);
}
for(char c: number.toCharArray()){
product *= Character.getNumericValue(c);
}
int [] tuple = {sum, product};
return tuple;
}
static int lcm (int [] tuple){
int multiplier = 1;
ArrayList<Integer> productMultiplier = new ArrayList<Integer>();
ArrayList<Integer> sumMultiplier = new ArrayList<Integer>();
while (true){
int sum = tuple[0] * multiplier;
int product = tuple[1] * multiplier;
sumMultiplier.add(sum);
productMultiplier.add(product);
if (productMultiplier.contains(sum)){
return sum;
}
if (sumMultiplier.contains(product)){
return product;
}
multiplier++;
}

}
}
>>
>>53524294
I don't know what the fuck you're saying
>>
File: 20160316_224858.png (103 KB, 994x537) Image search: [Google]
20160316_224858.png
103 KB, 994x537
>>53525495
You're welcome, lads
>>
File: metallica-master-of-puppets.jpg (42 KB, 344x488) Image search: [Google]
metallica-master-of-puppets.jpg
42 KB, 344x488
>>53525938
>mfw
>>
Your are blindfolded and left in a big square room of length size. Because you can't see anything, you tread carefully along the side of the room, forming a spiral shape as you walk. Now that you know how many 'steps' you have taken, you want to know your position in the room.

Example:

For size = 5 and steps = 20, the answer should be
Blindfolded(size, steps) = [2, 3].

Your path can be shown as the following figure:

[ 1, 2, 3, 4, 5],
[16, 17, 18, 19, 6],
[15, x, x, 20, 7],
[14, x, x, x, 8],
[13, 12, 11, 10, 9]

The 20th step brought you to the second "line" and "third" column (0-based), so the answer is [2, 3].

[input] integer size
The size of the room.

[input] integer steps
The number of steps you have taken.

[output] array.integer
Array of length two, describing your position in the room.
>>
>>53526017
Do your own homework.
>>
>>53523960
>"signed char" goes from -128 to 127
>which goes from 0 to 255
No!
>>
>>53526017
>For size = 5 and steps = 20, the answer should be
>Blindfolded(size, steps) = [2, 3].
This makes no sense. Shouldn't it be 3,4?
>>
>>53525872
who is that qt ^^
>>
>>53525866
E.g Autocompletion. I can easily check what methods are in that class.
>>
>>53526124
go out more m8. Girls like that are dime a dozen
>>
>>53525614
So you mean its not possible? :/ Okay then. Thanks for the reply tho
>>
>>53526214
but i want that one
>>
>>53526228
It is you fucking retard.
>>
>>53526228
LibraryName_MethodName
SDL_CreateWindow
Exactly the same thing.
>>
>>53526267
Yeah, but I if use like more than one SDL header. Like a jpg libary.
>>
>>53526292
Please explain what do you mean by that because your post makes no sense.
>>
>>53526292
>SDL
SDL_CreateWindow
>SDL_image
IMG_LoadJPG_RW
>>
>>53524850
>signed char still has 256 possible values
no, signed char has SCHAR_MAX-SCHAR_MIN+1 values
>>
>>53526338
>SCHAR_MAX-SCHAR_MIN+1
WRONG! It has SCHAR_MAX-SCHAR_MIN values.
>>
>>53526204
>Autocompletion
SDL_<hotkey for autocompletion>
>>
>>53526338
SCHAR_MIN is guaranteed to be at least -127 and SCHAR_MAX is guaranteed to be at least 127, so it's completely safe to assume that there will be at least 255 possible values.
>>
File: 1456341373236.jpg (264 KB, 852x813) Image search: [Google]
1456341373236.jpg
264 KB, 852x813
>>53526338
GO FUCK YOURSELF VERDAMMT!
>>
>>53526379
+1
>>
>>53526417
Nope
>>
>>53526390
>at least 255 possible values
agreed; I corrected
>has 256 possible values
>>
>>53526390
>completely safe to assume
Even better: it's guaranteed!
>>
>>53526379
0 is a valid value, worthless webshit!
Kyll you're self!
>>
>>53526503
I thought it was a range, not a substitution.
>>
>>53526442
WRONG! 255.
>>
File: 1458009910580.png (1 MB, 1160x1080) Image search: [Google]
1458009910580.png
1 MB, 1160x1080
>>53523989
>she
>>
>>53523989
>she
>>
>>53526547
>I was an idiot
>still am
>but I was too
>>
Why the fuck aren't C++ Strings VLSs? Isn't one of the stated goals of the language designers optimal code?
>>
>>53526843
but they are, nigga
>>
>>53525769
Code to learn
>>
File: 1454023889636.gif (2 MB, 338x338) Image search: [Google]
1454023889636.gif
2 MB, 338x338
>>53524099
sauce?
>>
>>53526916
jennifer lawrence
>>
>>53526861
Well fuck, I'm reading this assembler wrong. Nvm.
>>
>>53523939
Stop this programming trap meme.
>>
>tfw you own half of the (You)'s in /dpt/
>>
>>53527035
>I'm not a real programmer
sounds like you don't belong here m80
>>
>>53527035
Traps are programming related tho!
>>
>>53526970
Nvm, I'm right. Or at least that's what gcc outputs. a String arg comes in on rdi. [rdi] is an address to the beginning of the char array. [rdi+8] is the length. wth?
>>
>>53523958
https://a.pomf.cat/nexnun.webm
>>
>>53527185
MUH DICK!
(not gay tho)
>>
>>53524639
>>53523939

How do I properly take an int turn it to binary and then pad the empty space with 0 on the left ?
>499
>0111110011

using this:
        Scanner input = new Scanner(System.in);
int firstNumber = input.nextInt();
double secondNumber = input.nextDouble();
double thirdNumber = input.nextDouble();

String numberInHex = Integer.toHexString(firstNumber).toUpperCase();
String numberInBinary = String.format("%10s",
Integer.toBinaryString(firstNumber)).replace(' ', '0') ;

if (thirdNumber % 1 == 0) {
System.out.printf("|%-10s|%s|%10.2f|%-10.0f|", numberInHex, numberInBinary,
secondNumber, thirdNumber);
}
else {
System.out.printf("|%-10s|%s|%10.2f|%-10.3f|", numberInHex, numberInBinary,
secondNumber, thirdNumber);


System.out.printf("|%-10s|%s|%10.2f|%-10.0f|", numberInHex, numberInBinary,


this wont do it or I am missing something ?
>>
>>53527185
ugly bitch
Pic is a beautiful trap, this one is not.
>>
>>53527370
>shopped image
>beautiful
kys
>>
>>53527261
bump
>>
>>53523939
Haskell is gay
>>
>>53527441
Here is an ungimped one.
>>
File: Untitled40.png (61 KB, 1920x1029) Image search: [Google]
Untitled40.png
61 KB, 1920x1029
Working on the LDAP admin panel again.
Ditched my own interface for AdminLTE today.
So glad I did it.
>>
FUCK SQLALCHEMY
>>
>>53527740
wait till you have to use an even shittier orm (no, there's no good one)
>>
>>53527740
FUCK JEWS

>inb4 not programming
Sqlshitter is not programming either, go to back to /wdg/
>>
>>53527740
What's wrong with it?
I like it, except for the backref and specific type stuff, but SQLAlchemy-Utils fixes that mostly.
>>
File: fuckyes.png (11 KB, 674x459) Image search: [Google]
fuckyes.png
11 KB, 674x459
finally got this shit to work!

debugging go's cgo code means debugging c, don't know why i didn't realize that when I started. Classic /g/

I couldn't paint the area any color.
looking at my gco vs a similar c program with the same libs revealed my color was well beyond 1

cgo rgb: (39, 233, 25)
c rgb: (0.15, 0.91, .09)

should have been obvious, i use the same type of values for the alpha in css.

thanks for the help, gays!
>>
>>53527776
God please no, but really, I'm experiencing a weird ass bug and I even found some very similar bug report in their issue tracker that was related to a very specific database driver/connector version (which I'm not even using).

>>53527783
>databases are used only in web development
I take it you've never programmed anything outside of Fizzbuzz in C?

>>53527797
Session.query() randomly returns an empty set even when I'm a hundred percent sure there's a dataset to be returned, and once it happens, the method will keep returning an empty set until the session/engine is reset. I've also confirmed that this issue does not happen if I use Engine.execute().
>>
File: 139563730.gif (308 KB, 500x270) Image search: [Google]
139563730.gif
308 KB, 500x270
>>53523958
>she
you must be new here
>>
>>53527824
Never had that before. Almost sounds like some GC issue.
What kind of application are you using it in?
>>
>>53527902
Writing sort of a broker that routes messages from a game server to IRC and XMPP and vice versa.
>>
>>53526112
>what is a 0-based index
>>
File: browser.png (676 KB, 840x813) Image search: [Google]
browser.png
676 KB, 840x813
getting back into coding browser #112. just added larger text sizes for the first few lines of each reply.
>>
>>53524496
sure I'll simply compile my python to android then
>>
>>53527987
Python runs on Android, your point?
>>
>>53527921
Are you keeping a reference to the engine (and session) at all times?
>>
>>53527849
Mind your pronouns.
>>
>>53527966
Why is it named 1 if it is actually 0?
>>
>>53527973
Source?
Do you use webkit? I hope not.
>>
>>53523957
based java
>>
>>53528123
Yes.
>>
>set up webpack server to automatically refresh on file changes
>put an html5 canvas on a page
>begin writing webgl in vim next to your browser
>cum
>>
>>53528222
The the rows of the multi-dimensional array are indexed at starting with zero, the steps counted start at 1.
>>
>>53524639
>java
>eclipse
>>
>>53528301
epic meme fgt
>>
File: browser.png (2 MB, 1680x1050) Image search: [Google]
browser.png
2 MB, 1680x1050
>>53528241
no webkit.
it's a stand-alone exe that uses winapi.
>>
File: 256.jpg (29 KB, 367x451) Image search: [Google]
256.jpg
29 KB, 367x451
>>53524777
you should use an IDE for any programming language
>>
>>53528335
Source?
Did you made your own parsers and stuffs?
>>
File: browser.png (979 KB, 1167x1010) Image search: [Google]
browser.png
979 KB, 1167x1010
>>53528363
sorry, it's closed sores. just my own personal project.
100% handmade "parsers and stuff"
>>
>>53528418
>closed sores
You may fuck off then.
>>
File: browser.png (2 MB, 1680x1050) Image search: [Google]
browser.png
2 MB, 1680x1050
>>53528449
t-thanks :)
>>
class Chart
{
istream& operator>> (istream &in, Chart& cChart){
...
return in;
}



causes

/home/anon/Desktop/C++ Homework/Program 2/Chart.h|6|error: โ€˜std::istream& Chart::operator>>(std::istream&, Chart&)โ€™ must take exactly one argument|

where did I screw up?
>>
>>53528574
>must take exactly one argument|
>>
>>53528574
Either it has to be static or it has to not take the stream as a parameter.
>>
>>53528715
>>53528753
http://stackoverflow.com/questions/7416100/c-overloading-operator-strange-compile-error

How come these guys don't do that?
>>
>>53528574
>>53528846
Never mind >>53528753, you have to declare it outside the class.
>>
>>53524012
Ok dude I appreciate your dedication to the C standard but you are acting straight up autistic

like you're so far up the spectrum that i'm surprised your post isn't rendering in rainbows
>>
>>53528952
like the typical Ctard
>>
r8 my java int swap function
https://ideone.com/mnBNPV
    import java.lang.reflect.*;

class Ideone
{
static char n[];
static {
try{
Field field = Integer.class.getDeclaredFields()[3];
field.setAccessible(true);
n = (char[])field.get(1);
} catch(Exception e){}
}

public static void swap(int a, int b){
char t = n[a];
n[a] = n[b];
n[b] = t;
}

public static void main(String args[]) throws Exception {
int a = 1;
int b = 3;
int c = 7;
System.out.format("a = %d, b = %d, c = %d\n", a, b, c);
swap(a, b);
System.out.format("a = %d, b = %d, c = %d\n", a, b, c);
swap(b, c);
System.out.format("a = %d, b = %d, c = %d\n", a, b, c);
swap(a, c);
System.out.format("a = %d, b = %d, c = %d\n", a, b, c);
}
}
>>
It's not homework. This and the LCM question are both from codefights.com

It's worse than homework because then the douche will cheat enough and brag about his accomplishments in the professional world. which will discredit an otherwise decent website
>>
Hey /g/,

Very new to python.

Basically I'm creating a game with a deck of 9 "cards", each player gets a card and if it's higher it's given to the other players deck.

I'm having some troubles with the list and decks. I'm also extremely new so don't judge, if anyone could just POINT me in the right direction that'd help.


from random import seed,shuffle
s = input("Enter a seed value: ")
seed(s)
deck = [0,1,2,3,4,5,6,7,8,"Give3"]
shuffle(deck)
print("deck:",deck)
print()
one2 = deck.pop(1)
two2 = deck.pop(2)
one = []
two = []
while deck == True:
print("play:","\t",one,"\t\t",two)
if one > two:
one.append(two)
else:
two.append(one)
if two == []:
print("Player one wins!")
if one == []:
print("Player two wins!")
>>
>>53529098
does this literally swap the global values of integers?
>>
>>53529142
>brag about LCM solutions in the professional world
kid, 'the professional world' is not CS101
>>
>>53529177
>significant whitespace
>>
>>53528359
if you use an IDE for C you should probably kill yourself
>>
>>53529178
yes, my swap function is so powerful, it can swap literals!

https://ideone.com/7S81qA

    
System.out.format("1 = %d, 2 = %d\n", 1, 2); // 1 = 1, 2 = 2
swap(1, 2);
System.out.format("1 = %d, 2 = %d\n", 1, 2); //1 = 2, 2 = 1
>>
>>53523939
a frontend for waifu2x
https://github.com/cmdrkotori/qtwaifu2x/commits/master
>>
>>53529202
What about something like the Quake engine with a fuckton of components? Kinda nice to have a tool that helps you organize
>>
>>53529255
>qtwaifu2x

Holy fuck 11/10 name I already love it
>>
>>53529255
got a screenshot?
>>
>>53529203
no integer is safe.

https://ideone.com/8yL6ty

    System.out.format("42 = %d\n", 42); //42 = 42
swap(2, 4);
System.out.format("42 = %d\n", 42); //42 = 24


And you guys were saying java was shit
>>
>>53529329
I think it's swapping the char representation of the int.
System.out.format("2 + 3 = %d, 2 + 5 = %d\n", 2 + 3, 2 + 5); // 2 + 3 = 5, 2 + 5 = 7
swap(3, 5);
System.out.format("2 + 3 = %d, 2 + 5 = %d\n", 2 + 3, 2 + 5); // 2 + 3 = 3, 2 + 5 = 7

>3 + 2 = 3
>>
File: scr238.png (1001 KB, 1920x1080) Image search: [Google]
scr238.png
1001 KB, 1920x1080
>>53529321
>>
>>53529203
Some old Fortran and Algol 60 compilers actually let you swap and assign to literals because the literals were stored in memory and there's nothing like const to prevent you from doing it.
>>
>>53529531
The LISPs allow that too.
>>
>>53529177
while deck == True:

deck is never == True because deck is a list and lists are not boolean values.
if one > two:

you are compaing two lists with >. That doesnt do what you think it does.
>>
Anyone
>>
File: raytracer_sponza_huge_15bounces.png (499 KB, 799x512) Image search: [Google]
raytracer_sponza_huge_15bounces.png
499 KB, 799x512
>>53523939
Still raytracing. This certainly takes time :^)
This is the Sponza scene with some extra objects, totaling 200K+ tris. Not bad for a relatively simple SAH BVH.
>>
>>53529565
>python lets you compare bool to lists
that is quite stupid for a high level language that is claimed to be beginner friendly
>>
>>53529582
Anyone have any methods programming against reverse-engineering tools?
>>
>>53523939
hey /g/

trying to learn Unity to do basic apps

Scripting is hard though,following the tutorials on their website is easy enough as it's step by step,but what about when it's over?

They don't really go into detail as to WHY it works,simply "type this here and it works,now let's move onto the next step"

will i be shit out of luck after that? or where should I go if I want to improve my knowledge?
>>
>>53529596
noone cares about your shitty binary
>>
>>53529596
You can't stop a truly determined hacker. All you're doing is slowing down your own development time.
>>
hi i'm home.
>>
File: Capture.png (9 KB, 287x193) Image search: [Google]
Capture.png
9 KB, 287x193
G-guys i have a midterm coming up next week how the FUCK do i study for it? Im learning java/ data structures and i don't know what to do, pic related is what im going to be tested on!
>>
>>53529652
False, iLok 2 hasn't been cracked.
>>
>>53529678
yet
>>
>>53529673
That shit's easy. If you can't learn that in a week then wtf are you doing?
>>
>>53529673
you need to actually write code
>>
>>53529689
Actually it has, lol

It took years, but it finally has.
>>
>>53529565
True, but he's probably getting tripped up by the truthiness thing python does
>>
>>53529673
Easy as fuck.
>>
>>53529694
im scared, i have 2 hrs 30 min test time, im usually shit at tests too unless the material is second nature to me.

>>53529705
where's a website where i can get code assignments or practice
>>
>>53529735
>as fuck
>>
>>53529705
yourtextbook.com
>>
>>53529737
>2 hrs 30 min test time
More than enough time.
Have you programmed before?
Is it for uni?
What uni?
Do you actually like CS or went there for the monies/because it's cool?
What book are you using?
>>
>>53529737
meant to quote you
>>
I'm learning from 0 using c programming: a modern approach.

if i use char *p = "abc";
why doesn't puts(*p); works?
i simply don't get it.
it should be easy as hell but is one of those things that you just look at over and over again without making the neural conection. like when you are reading a book but you have to re-read something 3 or 4 times again because you're spacing out too hard.

Please, my mind is going full retard right now
>>
>>53529791
the type of p is char *
the type of *p is char
puts is for printing strings (char * with '\0' as last char), not chars
>>
>>53529791
>>53529812
So you should do puts(s) to print a string or putc(*s) to print the first character of the string.
>>
"abc" is const char*, you shouldn't try to cast it char*
Thread replies: 255
Thread images: 36

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

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
If a post contains illegal content, please click on its [Report] button and follow the instructions.
This is a 4chan archive - all of the content originated from them. If you need information for a Poster - you need to contact them.
This website shows only archived content and is not affiliated with 4chan in any way.
If you like this website please support us by donating with Bitcoin at 1XVgDnu36zCj97gLdeSwHMdiJaBkqhtMK