[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
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

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

Thread replies: 255
Thread images: 32
File: memes.jpg (46 KB, 677x511) Image search: [Google]
memes.jpg
46 KB, 677x511
dubs edition
>>
First for checkin' 'em
>>
>>52255722
Delete this you fucking nigger
>>
>>52255722
nice
>>
File: trap programmer.png (1 MB, 1702x2471) Image search: [Google]
trap programmer.png
1 MB, 1702x2471
Daily reminder that if you don't program while dressed like a schoolgirl, you don't belong on /dpt/.
>>
I am having some trouble with a freestanding binary. My linker script is placing a few object references in the wrong place. Does anyone have any knowledge about linker scripts and 64-bit multibooting in GRUB?
>>
Daily reminder not to keep living
>>
>>52255809
not if you use python, haskell or F#
>>
>>52255774
Will I be a Master Programmer if I start wearing a cute little skirt, or would I also have to have something in the butt?
>>
>>52255774
>Programming while crossdressing
I just kinda want some horribly degenerate book to be the literal go to source for everything on a subject.

>electrical engineering done gay
>"Yea, I know how it sounds, but honestly the text is the most comprehensive and easy to understand in the market."
>>
Reminder that the important parts of purity are that the same inputs will always yield the same outputs, and that evaluation strategy doesn't matter. There's no reason to forbid side effects as long as those laws are upheld.
>>
>>52255722
czech'd
>>
>get the code to compile
>undefined behavior suddenly
AAAAAAAAA

Also, fastest way to make webms?
>>
>>52255880
>that evaluation strategy doesn't matter
I don't agree on that point.
>>
>>52255880
reminder that the concept that all functions must be """"""""pure"""""""" is very autistic and ill-suited for real-world applications
>>
enum token_type {
BOOL, INTEGER, STRING, TUPLE
};

union token_val {
bool boolean;
int integer;
struct {
char *data;
size_t len;
} string;
struct {
struct {
enum token_type type;
union token_val value;
} *data;
size_t len;
} tuple;
};


Reposting. Compiler says field 'value' has incomplete type. Forward declaring it doesn't help.

How can I get it to work?

>>52255774
>tfw lent my only schoolgirl skirt to a friend

C-Can I stay anyway?
>>
>>52255925
Only if you lent it to a guy
>>
>>52255920
Why? That ensures that results can be shared or expressions simply ignored if their results aren't needed, without disrupting side effects. That's not the same thing as "dude make everything lazy lmao".

>>52255923
Explain yourself.
>>
>>52255941
Does a trap count as a guy? If so then yes.
>>
>>52256005
>Does a trap count as a guy
>>
>>52255997
Different evaluation strategy could lead to bottom or not. But if there was a result it would be the same.
>>
>>52256005
No, a trap is a girl, just look at the feminine penis.
>>
>>52255997
calculateCurrentAirplanePosition()


doesn't need to return the same value every time because the airplane isn't necessarily stationary
>>
>>52256045
I'll leave then ;_;
>>
>>52256074
It's okay, anon
I love you
>>
>>52256051
calculateCurrentAeroplanePosition(planeID, time)
>>
>>52256110
the position depends on previous input. you could run the program twice and for a certain time value the values could be different.
>>
>>52256132
calculateCurrentAeroplanePosition(planeID, time)
>>
>>52256166
>i have no concept of state
hasklel programmers everyone

your program is a glorified math expression, congrats
>>
>>52256191
calculateCurrentAeroplanePosition(planeID, FUCKING TIME THE CURRENT FUCKING TIME)
>>
>>52256132
So in a different method, you would specify for example the time it has departed and the speed. When you call this method, it calculates it for you and returns a different value each time you ask. How are you going to unit test this?
>>
>>52255907
First time using C I see. Enjoy the segfaults and undefined behavior my friend, wear them in good health :)
>>
>>52256214
>>52256219
retarded
>unit tests
kill yourself

you look at the algorithm, how the function is written in accordance to the algorithm, and how the result is in accordance to the expected result
>>
>>52256267
>i dereferenced a pointer to an array improperly
Yea, I'm sure I'll crash the pentagon next.
>>
>windows tablets
can't we just have full windows in smartphones too

drop the android garbage
>>
Aight friends. At the moment I got a job in Objective C language for like a year now, and I really don't like it. I'm planning to practice and do some examples in C# in Visual Studio environment. When I'll send job applications I'm also planning to send them some examples that I was working at home. So my question is, do I need to download Visual Studio Enterprise or Community Edition? Whats the difference?
Or can I just pirate Ultimate or whatever? Wont they notice? Thanks in Advance
>>
>>52256555
>do I need to download Visual Studio Enterprise or Community Edition? Whats the difference?

fuck I mean VS Express or Community Edition
>>
>>52256132
>you could run the program twice and for a certain time value the values could be different
so the same plane could be in two different places at the same time?
>>
>>52256555
Just do community. Ultimate edition or whatever just adds cruft, stuff like team foundation server.
>>
>>52256594
It seems like he's the one that doesn't understand state ;)
>>
>>52256608
Any idea whats the difference between Community or Express? I cant find the difference on their site. Or maybe I'm just too stupid.
>>
>>52256030
Oh, I see where you're going with this. That's why totality is also necessary.
>>
>>52256594
the time is arbitrary, it could be time since computer booted, time since program started, time since liftoff. just because you only give the input once doesn't suddenly make the function """"""""pure"""""""". and the input is completely redundant since the function calculates the CURRENT position - there is no requirement that it should keep track of all positions in the past, present and future (and knowing the future is only possible in a simulation type program, not a real-world application).
>>
>>52256661
https://www.visualstudio.com/en-us/products/compare-visual-studio-2015-products-vs.aspx
>>
>>52256616
kill yourself retard
>>
>>52256707
no community vs express
>>
File: ayy.webm (1 MB, 800x624) Image search: [Google]
ayy.webm
1 MB, 800x624
any advice guys?
>>
>>52256692
>>52256715

the simulation time you idiot
>>
>>52256051
Yeah, so you'd model state or whatever affects the plane's position as an input and output (if it needs to be modified). If you make it linear, you don't run into space leaks or invalid operations like copying or deleting the entire world.

It ends up working the exact same way as the imperative program, it's just made explicit so the code is easier to understand, and more importantly, easier to compose.
>>
>>52256742
advice on what you stupidfuck
>>
>>52256742
>completely flat design
this better be temporary
>>
>>52255925
Please respond.
>>
>>52256760
>>52256762
fuck i hate you retards

>you'd model state or whatever affects the plane's position as an input and output
this should be encapsulated, the client shouldn't need to manage state on its own

go fuck yourselves
>>
>>52256730
Wait, express still exists? Thought community replaced it.
>>
>>52256692
that's a data input problem
so then,
getcurrentplaneposition(positionsensordata, currenttime)


the processing chain in everything goes like this:
sensors/data input -> functions/processing -> output
sensors and data collection are inherently impure
functions are not inherently impure
however, many languages ignore this distinction and make functions impure, which complicates things
>>
>>52256828
got nothing to do with any client
>>
>>52256828
>this should be encapsulated, the client shouldn't need to manage state on its own
You mean it should be abstracted. Encapsulation is just one means to achieve abstraction. State can be abstracted away using a monad, for example.

Can't wait for the utter asspain that the word "monad" is going to cause you.
>>
>>52256863
yes it does, the "client" that calls the function just wants to know the position, it doesn't want to deal with sensor data, pilot input, weather conditions etc etc
>>
File: 1450068475344.jpg (36 KB, 352x352) Image search: [Google]
1450068475344.jpg
36 KB, 352x352
>>52256773
Will add some lines between the keys, but it will be pretty flat anyways.
>>
>>52256836
I'm arguing that I/O is not impure. Or rather, that it's not purity that matters, but the correctness of the program under certain conditions. >>52255880
>>
>>52256906
>Will add some lines between the keys
Please don't
>>
>>52256957
it's the bare minimum he needs to do
>>
File: 1392356017839.jpg (310 KB, 800x600) Image search: [Google]
1392356017839.jpg
310 KB, 800x600
>Converting C++ to C
>everything is alright, converting classes to structs and having function containing a pointer to that structure
>The C++ code all of sudden decides to use boost::intrusive_ptr
JUST
>>
is google analytics worth it
>>
>>52256957
it will be user removeable in the settings.
>>
>>52257029
Just use function pointers ;)
>>
>>52255722
wallpaper and not by the output of pacman -Qm Is Arch a good mech keyboard since I'm new at this point I wonder how you sit at your computer, you should have done good anon, had one for 1 or 2 years. Tutanota has an intel 945 chipset or whatever but unless it looks alright, though i'd go with Laravel, Debian for server
Not even funny So in the first time Linux user curious about BSD Stockholm syndrome, (x230 here) Yeah, its a fucking laptop, and having better value for a PMC 19 years young (xD)-I role play a hardworking individual that cares about your NEET shit you dingus
Holy shit, I don't know shit, so good my mum wouldnt notice anyway though, or at lots of rooms have landlines in them doesn't mitigate the crime locations and create much greater fear And also whether I should use a 1. io/ i think you will need a monitor up to around 10TB storage so it's plugged in is not my strong suite Reminds me of older styles, but has a database of exploits it tries based on whether you tap it or something HDMI to VGA adapter should work fine though, right

23, I work in a store, And god damn I wish it went to college in a much more dense form probably However, the only thing they sell $70 adapters if they actually got the abomination called gnome3) and apple sticked with gnome2 (instead we got the age progression was really wondering if i did a live CD and wiped a winblows install anyway
Countries Probably around 10 years the biodegradible wiring and lead-free solder will break down from heat and it takes brainpower
>>
File: â–².jpg (802 B, 34x16) Image search: [Google]
â–².jpg
802 B, 34x16
https://www.youtube.com/watch?v=K6Qc4oK_HqY

Looking to answer the puzzle in this video. It's quite easy to see that 6210001000 is an answer. However, I don't know if it's the only answer, so I tried to brute force the solution.

I wrote a code that goes through all 10 digit numbers to 6999999999, because it's easy to see that the first digit can't be larger than 6. Also take note that the sum of digits in such a number must add up to 10, hence the first function.

Sadly it's too slow. I have been running this for 5 hours now, it still hasn't finished and there seem to be no more solutions so far.

def sum_digits(n):
s = 0
while n:
s += n % 10
n /= 10
return s


def check(n):
if sum_digits(n) != 10:
return False
nstr = str(n)
for i in range(10):
count = 0
for j in nstr:
if i == int(j):
count += 1
if count != int(nstr[i]):
return False
return True


print check(6210001000)
n = 1000000000
while n < 7000000000:
if check(n):
print n
n += 1
>>
>>52257186
That's because it's not in C.
>>
File: 111299939356.jpg (75 KB, 600x789) Image search: [Google]
111299939356.jpg
75 KB, 600x789
I have a 32GB pirated Windows 8.1 partition with 17GB free, will I be able to develop some shitty C# app with visual studio or I need more space?
>>
>>52257036
But what if there are no users to remove it?
>>
>>52257186
>5 hours now
>>
>>52257238
Yes, Visual Studio "only" needs about 6GB
>>
>>52257238
Visual studio is fucking huge.
>>
What are the implications of passing a reference to a value inside the function and modifying it, versus assigning the return value of a function to the variable?
Both can do pretty much the same shit, but what are the Design Patterns(tm) surrounding both?
>>
Daily reminder that:


Beautiful is better than ugly.

Explicit is better than implicit.

Simple is better than complex.

Complex is better than complicated.

Flat is better than nested.

Sparse is better than dense.

Readability counts.

Special cases aren't special enough to break the rules.

Although practicality beats purity.

Errors should never pass silently.

Unless explicitly silenced.

In the face of ambiguity, refuse the temptation to guess.

There should be one-- and preferably only one --obvious way to do it.

Although that way may not be obvious at first unless you're Dutch.

Now is better than never.

Although never is often better thanrightnow.

If the implementation is hard to explain, it's a bad idea.

If the implementation is easy to explain, it may be a good idea.

Namespaces are one honking great idea -- let's do more of those!
>>
>>52257338
One is more useful for recursion than the other.
>>
Can Qt be used in commercial products freely or do you have to pay for a license?
>>
>>52257348
false
>>
>>52257348
thank you lord van rossum
>>
>>52257293
Why so salty? VS is pretty great.
>>
I wish I preferred working on my language to arguing about the principles it uses.
>>
How does one mimic boost::intrusive_ptr in C, or least a way to pass one object that can contain different types of objects, for my my case I'm using structs
>>
>>>52257348
>>52257449
>Errors should never pass silently.
>Python is kind to the programmer if there are fewer items than you ask for. For example, if you ask for a[:-2] and a only contains one element, you get an empty list instead of an error. Sometimes you would prefer the error, so you have to be aware that this may happen.

>Beautiful is better than ugly.
lol

>Explicit is better than implicit.
lol
>>
>>52257471
(Not him) For C#, pretty much. Its painful for c++, however.
>>
>>52257532
not sure why you'd think beautiful isn't better than ugly or why explicit isn't better than implicit, unless you actively love things that are cumbersome
>>
>>52255774
I keep a mini rex from bad-dragon in as a plug while I program. I don't own any cute clothes to crossdress with though.

>>52255722
VBA to C++ compiler in Common Lisp. I want to automate excel spreadsheet conversion to C++ because every time I finish some changes, the boss restructures the spreadsheets and I'm back at square one.
>>
>>52257576
>>>52257532
>not sure why you'd think beautiful isn't better than ugly
Maybe he's a linux UI dev
>>
>>52257576
python is ugly as shit and has implicitly declared variables
>>
DoSomething(); //Does something
faggot = var; //Assigns var to faggot
SuckDick(self); //Sucks own dick


Kill yourself if you do this :^)
>>
>>52257617
... What is your point exactly?
>>
>>52257617
opinions and explicit is still better than implicit in every aspect applicable
>>
>>52257645
I like gratuitous commenting more than inadequate commenting.
>>
>>52257645
This.
>>52257666
both are bad. Not that I expect satan to care.
>>
>>52257666
R E F A C T O R I N G
Your code should be refactored enough that a function name such as DoSomething() describes exactly what the function does. If that's not possible for some reason, there should be a short description of what the function does and what it is for next to the function declaration.
>>
// This is an example of a single line comment using two slashes

/* This is an example of a multiple line comment using the slash and asterisk.
This type of comment can be used to hold a lot of information or deactivate
code, but it is very important to remember to close the comment. */

package fibsandlies;
import java.util.HashMap;

/**
* This is an example of a Javadoc comment; Javadoc can compile documentation
* from this text. Javadoc comments must immediately precede the class, method, or field being documented.
*/
public class FibCalculator extends Fibonacci implements Calculator {
private static Map<Integer, Integer> memoized = new HashMap<Integer, Integer>();

/*
* The main method written as follows is used by the JVM as a starting point for the program.
*/
public static void main(String[] args) {
memoized.put(1, 1);
memoized.put(2, 1);
System.out.println(fibonacci(12)); //Get the 12th Fibonacci number and print to console
}

/**
* An example of a method written in Java, wrapped in a class.
* Given a non-negative number FIBINDEX, returns
* the Nth Fibonacci number, where N equals FIBINDEX.
* @param fibIndex The index of the Fibonacci number
* @return The Fibonacci number
*/
public static int fibonacci(int fibIndex) {
if (memoized.containsKey(fibIndex)) {
return memoized.get(fibIndex);
} else {
int answer = fibonacci(fibIndex - 1) + fibonacci(fibIndex - 2);
memoized.put(fibIndex, answer);
return answer;
}
}
}

test
>>
Im thinking about creating a simple p2p chat client that encrypts the messages sent so i can just throw something on my resume.
is this a good idea pls respond
>>
File: 1452033080008.jpg (30 KB, 500x333) Image search: [Google]
1452033080008.jpg
30 KB, 500x333
>>52257774
>fibonacci(fibIndex - 1) + fibonacci(fibIndex - 2);
triggered, regardless of memoization, those are almost doubled function calls and hashmap checks
>>
>>52257699
Of course both are bad.

But I'd rather someone be anal retentive explaining what they 'wanted' a section of code to do than have someone jam a bunch of random words together and comment nothing as if they'll remember what the intention was 2 years later.
>>
>>52257648
the assburger is strong ITT

>>52257348 is the "python philosophy"
>>52257449 thanks the creator of python
>>52257532 lols at the "python philosophy" because it contradicts what python is actually like
>>
Is it anti-python hour again where we now pretend the language is ugly?
>>
>>52257831
>is the "python philosophy"
>thanks the creator of python
Didn't know those things.
>the assburger is strong ITT
k
>>
I can only manage to write about ~100 lines of code a day
I'm worthless
>>
>>52258015
tbf I can only manage ~100 memes a day
>>
>>52258015
Quality over quantity, Anon
>>52258035
Literally kill yourself
>>
>>52258015
Once I spent a whole day, just to change one char in a code file.
>>
>>52258041
:^)
>>
File: firefox2.png (374 KB, 648x429) Image search: [Google]
firefox2.png
374 KB, 648x429
>>52257186
>Update:

Still running, but I've reached 6210001000! Seems to be the only answers
>>
>>52257582
>VBA to C++ compiler in Common Lisp.
You're a glutton for pain, eh?
>>
File: dse.png (71 KB, 1339x649) Image search: [Google]
dse.png
71 KB, 1339x649
Any tips for making a non-disgusting dark-like-my-soul theme?
>>
{
public static void main(String[] args)
{
int numberOfValues = Integer.parseInt(args[0]);
int valueBefore = 0;
int valueTwoBefore = 1;
int thisValue;
for(int value = 1; value <= numberOfValues; value ++)
{
thisValue = valueBefore+valueTwoBefore;
valueTwoBefore = valueBefore;
valueBefore = thisValue;
System.out.printf("%2d %-10d\n", value, thisValue);
}
}
}
Am i a noob
>>
>>52258323
dark grey
medium grey
orange highlights
>>
>>52258300
common lisp is comfy.
I'm most knowledgeable in C++ but would prefer not to have to write it if I can help it. It's clunky and a bit of a pain in the ass a lot of the time.
I didn't ask for VBA. I originally pushed the team to stop using VBA and to let me work in Clojure but the head honcho goes "C++ is fast so we use C++. Nobody knows Clojure either" [spoiler]as it turns out I'm the only person on the team who knows C++ so I don't know what that argument was about[/spoiler]
>>
>>52255925
A-Anyone?
>>
>>52258336
What does this do?
>>
>>52258323
twily.info
fag
>>
>>52258350
who decided lack of spoiler tags was a good thing?
>>
>>52258336
>Using args[0]
Yup
>>
>>52257774
100% triggered
>>
>>52258395
Some newfag called mood or something. Hiroyuki just listened when this newfag straight from tumblr told him to remove spoilers from /g/.
>>
>>52258336
fib
>>
>>52258403
whats wrong with args[0]
>>
>>52258463
Boku no Program
>>
>>52258336
Does that even work?
you should use an array so you don't have to change 3 values in memory for every iteration of the loop

also you should use C or D
java is a cancer
>>
>1 == True;
>0 == False;
Jesus christ how horrifying
>>
>>52258463

Exactly. How else would you get the first argument passed to the program?

>inb4 args[x-x]
>>
>>52258507
It does work although you can only get up to the 46th term using ints
>>
>>52258509
void countdownFrom(int a) {
while(a--) {
cout << a << endl;
}
}
>>
>>52258336
looks okay but read up on the java code style guidelines and start using an IDE if you aren't already
>>
>>52258572
also use %n instead of \n for a platform-independent newline
>>
>>52258372
>twily.info
>>>/mlp/
>>
>>52258572
Cheers, can you recommend any IDE's?
>>
r-rate my character histogram program

#include <stdio.h>
#define MAXVALUE 255 //biggest ASCII value

int main()
{
int c,i;
char charrContainer[MAXVALUE];
char charPrint;

for(i=0; i<MAXVALUE; i++){
charrContainer[i] = 0;
}

while( (c = getchar()) != EOF ){
++charrContainer[c];
}

for(i=0; i<MAXVALUE; i++){
charPrint = i;
if( charrContainer[i] > 0)
printf("%c\t%d\n",charPrint, charrContainer[i]);
}
return 0;
}
>>
>>52258593
the creator's a ponyfag, so what. It's a dark theme that's easy to copy-paste. My main gripe with it is the contrast between the purples is too low.
>>
>>52258543
public static void main(String[] args) {
int n = Integer.parseInt(args[0]);
long[2] fib = {0,1};
for (int i = 0; i < n; i++) {
System.out.println(n + ": " + fib[i%2]);
fib[i%2]+=fib[(i+1)%2];
}
}

I don't even know java, so I don't know if that'll compile or whatever you do with java, but that should be way more efficient
>>
File: success!.png (1 KB, 236x47) Image search: [Google]
success!.png
1 KB, 236x47
>>52257186
>>52258137
Did it!!!

Apparently there is only one answer to the puzzle. And it took only 7 hours!
>>
>>52258616
eclipse
i don't recommend netbeans
some people like intellij idea but i like eclipse and it seems to be the most popular IDE for java
>>
is there any where online to make money from programming? like im assuming web based languages is most popular but 'm not sure
>>
>>52258721
I'm
>>
>>52258669
it'll compile if you remove the 2 from long[2] but i strongly doubt it'll be more efficient
>>
What's an efficient way to convert UTF-16 to UTF-8 in C?
>>
>>52258721
do one of those challenge sites for a bit
most of them are just a thinly veiled recruitment tool for poodoo rajesh's codemonkey sweatshop
>>
Is:
if (thing != null) {
switch (thing.ID) {
case 1:
case 2:
case 3:
case 4:
return true;
}
}
return false;

equivalent to:
switch (thing?.ID) {
case 1:
case 2:
case 3:
case 4:
return true;
default:
return false;
}
>>
>>52258776
It depends. Do you have 5 cocks up your ass? If so, maybe.
>>
What's a good keyboard for programming for under $50 dollars?
>>
>>52258721

If you want to beg for work and get paid fuck all head on over to upwork or fiver.
>>
>>52258817
get a $2 one from a parts shop
any keyboard more expensive than that is a meme

>$50 dollars
>>
File: VENG_K95_RGB_K_US_top.png (393 KB, 750x363) Image search: [Google]
VENG_K95_RGB_K_US_top.png
393 KB, 750x363
>>52258817
imo you should definitely spend a little extra on a high-end keyboard if you're serious about programming
>>
File: YH4pMle.jpg (32 KB, 480x480) Image search: [Google]
YH4pMle.jpg
32 KB, 480x480
Is there a way to access the variables of an instantiated classes's parent in java?
Something like this(pseudocode, obviously)

public class Parent{

int value = 0;
Child child = new Child();

}

public class Child{
int value = 0;

public child(){
this.value = parent.value;
}

}
>>
>>52258856
only 18 macro keys? what are you programming in, Java?
>>
>>52258876
share programming macros
>>
>>52258875
mark value and/or its accessor as 'protected'
>>
>>52258856
That's the exact keyboard I have for my gaming rig.

It's shit.
>>
>>52258817
Get anything with Topre switches.
If you want clacky keys for cheap, get a Model M, dell at101w, or unicomp
>>
>>52258836
fugg pajeet who works for 1 dollar an hour
>>
>>52258621
change
charrContainer[] 
to int32
>>
>>52258901
goddamn i was hoping i had found a decent one

looking for a stylish mechanical keyboard with rgb lighting, numpad and macro keys
>>
>>52258876
Fresh off the boat, from reddit, kid? heh I remember when I was just like you. Braindead. Lemme give you a tip so you can make it in this cyber sanctuary: never make jokes like that. You got no reputation here, you got no name, you got jackshit here. It's survival of the fittest and you ain't gonna survive long on 4chan by saying stupid jokes that your little hugbox cuntsucking reddit friends would upboat. None of that here. You don't upboat. You don't downboat. This ain't reddit, kid. This is 4chan. We have REAL intellectual discussion, something I don't think you're all that familiar with. You don't like it, you can hit the bricks on over to imgur, you daily show watching son of a bitch. I hope you don't tho. I hope you stay here and learn our ways. Things are different here, unlike any other place that the light of internet pop culture reaches. You can be anything here. Me ? heh, I'm a judge.. this place.... this place has a lot to offer... heh you'll see, kid . . . .that is if you can handle it...
>>
>>52258817
depends
do you want normal
http://www.amazon.com/Logitech-Wireless-Combo-MK270-Keyboard/dp/B00BP5KOPA

or autistic manchild tier?
http://www.amazon.com/AULA-Backlit-Gaming-Keyboard-Colorways/dp/B00FWK8UWI/

These are the best-selling keyboards on amazon
>>
>>52258888
ctrl+c
ctrl+v
{
}

that's it for me but i only have 3 keys and 2 clicky buttons on the left hand side
>>
>>52258931
>rgb lighting
you don't need that
>numpad
you don't need that
>macro keys
you don't need that
>>
bored programmer here, what the fuck should I do?
>>
>>52258967
>>rgb lighting
nothing wrong with lighting and i want adjustable brightness and color (blue/white/red)

>>numpad
very convenient for entering numbers

>>macro keys
yes i do especially with a swedish keyboard layout which doesn't have conveniently placed curly braces
>>
File: y9h6hsB.jpg (72 KB, 322x720) Image search: [Google]
y9h6hsB.jpg
72 KB, 322x720
>>52258896
How would that let me access the parent's variables from the child?
I'm trying to access/change variables from the child class in the particular instance of the parent class it was instantiated in, essentially the exact reverse of the typical
Child child = new Child();
child.foo = bar;

but with referencing the parent instead of the child.
>>
>>52258925
Can you explain, please?

I'm assuming int32 is smaller than an int so I'm saving memory space because I cap out at 255 values? I haven't seen that variable type before. Also why an int if it's a char?
>>
how 2 python webscrape???????
>>
>>52258967
>numpad, you don't need that
numpads are useful and 60% keyboards typically cost MORE.
>>
>>52259027
In my example i was assuming you were inheriting not just having the child within the parent.

In your situation you'll need some kind of event set up that the parent listens for, but now you're coupling them together.
>>
>>52258995
if you want rainbow lights, get a gamer keyboard, you dumbmanchild
>>
>>52258925
why?
>>
>>52259028
a char counter is 8 bits so you will only be able to count up to 256, with an int32 you can count up to 2 billion.
>>
>>52259060
not necessarily rainbow lights but just so i can change the color so i'm not stuck with blue which is pretty much deprecated by now.

>get a gamer keyboard
well i was interested in >>52258856 but anon said it's shit
>>
File: dfe.jpg (42 KB, 736x414) Image search: [Google]
dfe.jpg
42 KB, 736x414
>slow /dpt/
>>
>>52259052
Alright, thanks anon
>>
>>52258715
>7 hours
Python, ladies and gentlemen.
>>
>>52259131
how about no colors instead, you dumb manchild
>>
I want to write a program that returns some text that's subject to change in a website, like a stream title on a twitch streamer's page. Is this what an HTML parser is? Do I look into that?
>>
>>52258715
if you did it in a reasonable language it would have taken at most 10 minutes even with your brute force solution
>>
>>52258336
valueTwoBefore should become thisValue, and valueBefore should become valueTwoBefore.
>>
>>52259027
Why the fuck do the japs make the girl super-wide (like she's been resize-tool'd from a regular size) in anything size-difference related?
>>
>>52259295
>why can't japs draw
who the fuck even knows?
>>
>>52258776
In the second one, if thing is null, you'll receive a runtime error when trying to access ID, no?
>>
Where can I read the source code for the functions in C's standard libraries?
>>
>>52258463
>>52258515
It's the program name lads, unless Java does it differently
>>
>>52259493
https://www.gnu.org/software/libc/download.html
>>
File: file.png (312 KB, 425x462) Image search: [Google]
file.png
312 KB, 425x462
>when his skills starts with "visual basic"
>>
>>52259493
Look for the glibc source code
>>
>>52259197
>>52259266
Prove it!

Do it and time it, the code is not hard. Python is not THAT slow. The problem is simply not brute force-able in minutes.
>>
>>52259535
>vb6
>not the tightest shit
>>
>>52259619
Python is 50x slower than non-shit languages. Thus, one can expect to be done in around 7-10 minutes instead of 7 hours.
>>
>>52259619
i already ran it but i hit array out of bounds on 999999999[10] because of an off by one error

running it again now
>>
>>52259708
6210001000
Time taken: 185307905921


that's 3 minutes 5 seconds in java on one core of an old ass core 2 duo with a completely naive and exhaustive brute force search except for numbers with leading zeros ( it tests 1000000000 to 9999999999)

>le java slow meme

    static final int[] count = new int[10];
static final int[] zeros = new int[10];
public static void main(final String[] args) {
final long startTime = System.nanoTime();
int d0 = 0, d1 = 0, d2 = 0, d3 = 0, d4 = 0, d5 = 0, d6 = 0, d7 = 0, d8 = 0, d9 = 0;
for(long i = 1; i <= 9999999999L; ++i) {
System.arraycopy(zeros, 0, count, 0, 10);
if(++d0 == 10) {
d0 = 0;
if(++d1 == 10) {
d1 = 0;
if(++d2 == 10) {
d2 = 0;
if(++d3 == 10) {
d3 = 0;
if(++d4 == 10) {
d4 = 0;
if(++d5 == 10) {
d5 = 0;
if(++d6 == 10) {
d6 = 0;
if(++d7 == 10) {
d7 = 0;
if(++d8 == 10) {
d8 = 0;
++d9;
}
}
}
}
}
}
}
}
}
++count[d0];
++count[d1];
++count[d2];
++count[d3];
++count[d4];
++count[d5];
++count[d6];
++count[d7];
++count[d8];
++count[d9];
if(count[0] != d0) {
continue;
}
if(count[1] != d1) {
continue;
}
if(count[2] != d2) {
continue;
}
if(count[3] != d3) {
continue;
}
if(count[4] != d4) {
continue;
}
if(count[5] != d5) {
continue;
}
if(count[6] != d6) {
continue;
}
if(count[7] != d7) {
continue;
}
if(count[8] != d8) {
continue;
}
if(count[9] != d9) {
continue;
}
System.out.printf("%d%d%d%d%d%d%d%d%d%d%n", d0, d1, d2, d3, d4, d5, d6, d7, d8, d9);
}
final long endTime = System.nanoTime();
System.out.printf("Time taken: %d", endTime - startTime);
}
>>
File: hello.png (7 KB, 806x625) Image search: [Google]
hello.png
7 KB, 806x625
>spent half an hour debugging because of a I/O error when loading the shader file
I'm glad it's over.
>>
>>52259777
wait it skips 0000000000 but it actually tests 0000000001 etc because of the if(++d0 == 10) d0 = 0
>>
>>52259027
I'm not sure what the big picture is with what you're wanting to do and why you think the current path you're going down is the right one.
There's only one instance of an object here. There's no "parent object instance" and "child object instance". When you create Child (new Child()) child is both an instance of the Child class and the Parent class at the same time.

If you want to modify the parent so other children can have the new changes when they're instantiated, have a "parent" class which is its own object and have a child class which does not inherit from parent. Rather, you'd compose your child class by having a reference to the separate parent object. New child class instances would also have a reference to a parent class which happens to be the one instance of parent you made earlier.
>>
>>52256742
add a to hex or binary function
>>
>>52255841

Don't wear a skirt. Grow a beard like me, and many great programmers:

http://www.wired.com/2012/06/beard-gallery/

If you don't seem to grow much facial hair, you can increase your natural testosterone levels by drinking less alcohol, and eating more meat. I seek to eat some meat every day. In fact, I am eating a beef and cheese burrito as I type this. Low testosterone levels in men are associated with cognitive impairment, so make sure you're getting a good diet.

http://www.ncbi.nlm.nih.gov/pubmed/17132744

>>52255925

Okay, now that I'm no longer busy with school, I can recognize the problem: value isn't a pointer, despite being in a struct that is a pointer type. Consider doing what TinyScheme does:

/* cell structure */
struct cell {
unsigned int _flag;
union {
struct {
char *_svalue;
int _length;
} _string;
num _number;
port *_port;
foreign_func _ff;
struct {
struct cell *_car;
struct cell *_cdr;
} _cons;
} _object;
};
>>
>>52259777
>naive
I'll say
>>
>>52258875
Why don't you just do

public class Parent{

int value = 0;
Child child = new Child(value);

}

public class Child{
int value = 0;

public child(String value){
this.value = value;
}

}
>>
File: logo.gif (6 KB, 133x63) Image search: [Google]
logo.gif
6 KB, 133x63
What's your excuse to not be using Free Pascal right now?
http://www.freepascal.org/advantage.var
Don't you want to write once and compile anywhere?
>>
>>52260077
>value isn't a pointer, despite being in a struct that is a pointer type

I figured as much, but is there really no way around it?
>>
>>52259777
6210001000
Time taken: 154254012970


2 minutes 34 seconds

    static final int[] count = new int[10];
static final int[] zeros = new int[10];
public static void main(final String[] args) {
final long startTime = System.nanoTime();
int d0 = 0, d1 = 0, d2 = 0, d3 = 0, d4 = 0, d5 = 0, d6 = 0, d7 = 0, d8 = 0, d9 = 0;
while(true) {
System.arraycopy(zeros, 0, count, 0, 10);
if(++d9 == 10) {
d9 = 0;
if(++d8 == 10) {
d8 = 0;
if(++d7 == 10) {
d7 = 0;
if(++d6 == 10) {
d6 = 0;
if(++d5 == 10) {
d5 = 0;
if(++d4 == 10) {
d4 = 0;
if(++d3 == 10) {
d3 = 0;
if(++d2 == 10) {
d2 = 0;
if(++d1 == 10) {
d1 = 0;
if(++d0 == 10) {
break;
}
}
}
}
}
}
}
}
}
}
++count[d0];
++count[d1];
++count[d2];
++count[d3];
++count[d4];
++count[d5];
++count[d6];
++count[d7];
++count[d8];
++count[d9];
if(count[0] != d0) {
continue;
}
if(count[1] != d1) {
continue;
}
if(count[2] != d2) {
continue;
}
if(count[3] != d3) {
continue;
}
if(count[4] != d4) {
continue;
}
if(count[5] != d5) {
continue;
}
if(count[6] != d6) {
continue;
}
if(count[7] != d7) {
continue;
}
if(count[8] != d8) {
continue;
}
if(count[9] != d9) {
continue;
}
System.out.printf("%d%d%d%d%d%d%d%d%d%d%n", d0, d1, d2, d3, d4, d5, d6, d7, d8, d9);
}
final long endTime = System.nanoTime();
System.out.printf("Time taken: %d", endTime - startTime);
}
>>
File: 452.gif (705 KB, 500x500) Image search: [Google]
452.gif
705 KB, 500x500
What email host does /dpt/ recommend?
>>
>>52260193
I have a heartfelt question. Why don't you just put d0, d1, as indexes in an ArrayList and use those as your variables. Refactoring it so my eyes don't bleed is essential.
>>
>>52260215
If I knew how I would host one myself.
>>
>>52260242
you mean like int[] d = new int[10]? array access is slower than using primitives and i just threw together whatever would work anyway
>>
>>52260247
It's not hard
>>
>Meijer et. al go so far as to condemn functional programming without recursion schemes as morally equivalent to imperative programming with goto. While comparisons to Djikstra’s infamous letter to the ACM are often inane, the analogy is apt: just as using while and for loops rather than goto brings structure and harmony to imperative control flow, the use of recursion schemes over hand-written brings similar structure to recursive computations. This insight is so important that I’ll repeat it: recursion schemes are just as essential to idiomatic functional programming as for and while are to idiomatic imperative programming.
>>
why dont you linux users just shove all this open source bullshit up your own ass. no one cares about compiling or configuring or any of the bullshit you constantly jack off about. we normal people just care about chatting and sending email to our friends and viewing the www so please shut the fuck up about foxfire or whatever the fuck tangent you're going off on. thanks for reading this. dongs.
>>
>>52260242
Or even int[] d = new int[10] is fine, yes. Any type of array, primitive or not. You can remove 95% of those lines by just making an array.
>>
>>52260281
Would you be kind enough to explain how?
>>
>>52260295
>no one cares about compiling
in /dpt/ that certainly true
>>
>>52260279
Oops, this:
>>52260306
was meant for you.
>>
File: disgusted_pepe.jpg (101 KB, 1024x904) Image search: [Google]
disgusted_pepe.jpg
101 KB, 1024x904
>the domain name i want is taken
>it's not even being used for anything
>>
>>52260310
FUBU BIG CHAINZ DUBZ $BLING$ $BLING$ FUCK DA 5-0 BITCHES BLUNTS 40Z KICIKIN IT BLUNTED JARNELL BABY MAMMA CHILD SUPPORT CHICKEN AN WATERMELON KOOL AID DA RED KIND FOOD STAMPS WESTSIDE $$CASH MONIES$$ DRIVE BY RYDE OR DIE NIGGA RUFF RYDA 4 LYFE PHAT ICE PHAT BLUNT DENZEL WASHINGTON ROCAWEAR ICE BLING BLING 5-0 187 MURDA MURDA FOOD STAMPS BLUNTS PAPERZ BLAZED WELFARE CHITLINS GRITS KOOL AID HOLLA BACK FUCK DA POLICE ROLLIN IN DA BENZ-O
>>
>>52260307
just need to download and run a mail server and make sure your ports are open over your internet connection. That's about it.
>>
>>52260177

Nope. You can't make a struct with an incomplete type, because you don't know how big it is.
>>
>>52260329
Use another TLD.
>>
>>52260337
I don't understand what is happening. I don't this anon is well.
>>
File: re.jpg (15 KB, 261x323) Image search: [Google]
re.jpg
15 KB, 261x323
>>52260346
>running a server on your main PC
>>
>>52260357
Speaking of unknown, you're a huge assblaster. You're like one huge slimey smelly rocket, flying through space at speeds unknown to man, and shooting off fumes which slightly resemble broccoli and rotted meat. But it's ok, because your flaccid asscheeks, worn from shits that rival the titantic herself, will make up for the kinetic energy lost from your inefficient use of the natural gas the infinitely spews from your cum-filled stomach.

>>52260371
FUCK you. I'm fine. Just maybe a bit drunk.
>>
>>52260077
>Low testosterone levels in men are associated with cognitive impairment
I've heard that high testosterone in the past, not sure which to trust
>>
>>52260387
testosterone leads to baldness
>>
>>52260381
What's wrong with running a server on your main PC, anon?
>>
>>52260381
you can do that if you like anon, I won't judge you.
>>
>>52260399
Linux is illegal! You are breaking the law, and hurting yourself and your family with your ILLEGAL SOFTWARE. Your ip has been noted and is being forwarded to the SPA with a reccomendation that they investigate your CRIMINAL ACTIVITY. Please destroy all your unpatriotic linux software before you are arrested!
>>
File: 1441954954343.jpg (14 KB, 257x253) Image search: [Google]
1441954954343.jpg
14 KB, 257x253
i don't like programming anymore. what are some other /g/ professions
>>
>>52260412
you okay anon?
>>
>>52260431
Living in your mom's basement.
>>
>>52260450
my mom doesnt have a basement.
>>
>>52260357
Just for my own personal sanity, it IS easily possible to calculate how big it would be if this worked, right?
>>
>>52260448
yeah senpai.
just lemme enjoy my beer and shitpost a bit alright?

By the way. As I was reading that, my cat rubbed against my leg, and it surprised me. But it felt kind of good, so I let her continue. After about five minutes of this, I was feeling pretty horny, and from her erect nipples, I could tell my cat was too. I picked her up and put her in my lap. She purred as I unzipped my pants, revealing my enormous boner. Then, without warning, she bit the head of my penis with her sharp fangs.
>>
>>52260431
being a drain on society
>>
>>52260306
running this now

    static final int[] count = new int[10];
static final int[] zeros = new int[10];
static final int[] d = new int[10];

public static void main(final String[] args) {
final long startTime = System.nanoTime();

loop:
while(true) {
System.arraycopy(zeros, 0, count, 0, 10);

for(int i = 9; i != 0; --i) {
++d[i];

if(d[i] != 10) {
break;
}
else {
d[i] = 0;
}
}

if(d[0] == 10) {
break;
}

for(int i = 0; i != 10; ++i) {
++count[d[i]];
}

for(int i = 0; i != 10; ++i) {

if(count[i] != d[i]) {
continue loop;
}
}

for(final int i : d) {
System.out.print(i);
}

System.out.println();
}

final long endTime = System.nanoTime();

System.out.printf("Time taken: %d", endTime - startTime);
}


looks a lot cleaner but i suspect it will be slower
>>
I want to program but I don't know what to program

I don't feel like doing something that will take more that two days though

any ideas?
>>
>>52260492
Test out the speed differences and get back to me. I'm curious as I haven't been bothered to see by how much.
>>
File: 9uy.jpg (68 KB, 1280x720) Image search: [Google]
9uy.jpg
68 KB, 1280x720
why do you think grills live longer than men?

my theory is losing blood through menstruation somehow makes them live longer, and men could reproduce this effect by draining their blood every now and then.

what do you think about my theory, /dpt/?
>>
>>52260346
It's really that easy? Do I have to worry about anything if letting people register accounts?
>>
>>52260492
restarting with

for(int i = 9; i >= 0; --i) {
>>
>>52260508
program to convert microwave time into regular time?

Did you know that spiders cannot physically die of natural causes? If kept safe, a spider can continue to live and grow larger for a theoretically unlimited amount of time. In fact, in China there exists a collection of 'holy' spiders, hatched some 2,800 years ago during the height of the Mang-Tsun dynasty.

>>52260517
shut the fuck up.
>>
>>52260508
write a basic text editor
>>
>>52260431
I'm burned out on programming as well. I'm considering getting back into art and putting out some hentai for commissions.
I'm also thinking about putting my sculpting and lampworking skills to use and creating custom figurines to swipe peoples' neetbux.
>>
>>52260482
... Mr Plinkett?
>>
>>52260545
id buy your hentai anon. ill pay you 20 bucks to draw me a pic of piper from fallout 4 fucking a ghoul
>>
>>52260517
Women simply take better care of themselves.
>>
>>52260517
Men are more biologically "disposable" than women so they age faster
>>
>>52260560
u dont even know me kid shut the fuck up hidin behind your computer i'd fuckin lump u out if you fronted on me like that in person kid
>>
>>52260520
restarting again with
                if(d[i] != 10) {
break;
}
else if(i != 0) {
d[i] = 0;
}
>>
File: cvx.jpg (165 KB, 1280x720) Image search: [Google]
cvx.jpg
165 KB, 1280x720
>>52260571
>>52260574
i don't buy it, anons.

i think my theory that losing blood every now and then somehow increases your lifespan.

i'm going to buy some mice and test it.
>>
>>52260623
Go cut yourself like a teenage emo brat and see if it helps.
>>
>>52260623
test it on yourself weebshit.
Can anyone tell me how many times these high and mighty evolution scientists have already backpedalled and changed their version of the truth to fit some new finding? I've already lost the count... pathetic, really.
>>
>>52260635
that isn't a very safe way to drain blood.

and besides, i'm going to test it with mice first.
>>
>>52260492
>>52260514
6210001000
Time taken: 189391278064


3 minutes 9 seconds with the array instead of 2 minutes 34 seconds with the primitives. slower but not bad at all
>>
>>52260684
If you want a safe way to donate blood, go donate blood or something, so it doesn't go to waste.
>>
>>52258715
> Apparently there is only one answer to the puzzle. And it took only 7 hours!
6 milliseconds with glpsol:
set D := {0..9};

var x{D,D}, integer, >= 0, <= 9;
var n{D}, integer, >= 0, <= 9;

maximize result: sum{i in D} n[i] * (10**i);
s.t. rsum{r in D}: sum{c in D} x[r,c] = n[r];
s.t. csum{c in D}: sum{r in D} x[r,c] * r = n[c];
s.t. col{c in D}: sum{r in D} x[r,c] = 1;

end;


But even using a conventional programming language, optimising the algorithm would have been far more profitable than changing the language.
>>
>>52260560
heh
Thread replies: 255
Thread images: 32

banner
banner
[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.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.