[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: 29
File: 1449879310939.jpg (17 KB, 293x324) Image search: [Google]
1449879310939.jpg
17 KB, 293x324
what are you working on /g/?
>>
>>51856207
might be more suited for this thread can anyone help me out with >>51855536
>>
>>51856207
I was thinking of making a buzzword filled insult generator for epic 4chan posts. I want it to be a little more complicated than a simple adlib filler.
>>
>>51856207
Dick squats and fart basket poo skiddlies mr. neighbor
>>
Studying the chatbot anon released yesterday. PHP isn't very familiar to me atm.
      // Holy Grail
else if ($row == 0)
do {
$str = explode("\n", $str);
$msg = consume1($str);
$msg = explode(" ", trim($msg));
$msg = remnull($msg);
$str = implode("\n", $str);
if (count($msg) < 2 || $msg[0] != "nl:") break;
consume1($msg);
$tokens[] = array_merge(["nl"], $msg);
$index++;
} while ($row == 0);
else
$out[$index] = (isset($out[$index]) ? $out[$index] : "").consume1($str);

There's a lot of interesting ideas in the code however.

>>51856220
wdg?
>>
>>51856223
How will it work anon?
>>
>>51856220
We have a web development general on /g/ anon.

>>51827781
>>
>>51856207
Stop making duplicate threads just because you were late, you fucking autist.

real thread here
>>51856111
>>
>>51856207
Becoming depressed because I learned Java before C++ and now I'm trying to figure out why the hell I'm getting segfaults.
>>
>>51856246
>>51856272
my bad anons, thanks
>>
>>51856207
>Stroustrup
That man should be executed for crimes against syntax and humanity.
>>
name: Rudolph speed: 22 f_time: 8 r_time: 165 state: 2 
name: Cupid speed: 8 f_time: 17 r_time: 114 state: 2
name: Prancer speed: 18 f_time: 6 r_time: 103 state: 2
name: Donner speed: 25 f_time: 6 r_time: 145 state: 2
name: Dasher speed: 11 f_time: 12 r_time: 125 state: 2
name: Comet speed: 21 f_time: 6 r_time: 121 state: 2
*** Error in `./day14p01': free(): invalid next size (fast): 0x000000000242c340 ***
Aborted


What could be causing this?
I'm not freeing anything at this point in the program, and valgrind claims it has something to do with the strcpy in >>51854554
>>
How do I upgrade from cl to gui. They only taught us cl in uni.
>>
>>51856324
use valgrid degozaru
>>
File: Tour-front-and-back.jpg (371 KB, 1153x704) Image search: [Google]
Tour-front-and-back.jpg
371 KB, 1153x704
>>51856324
Try reading through Stroustrup's Tour++ anon. It's a quick and dirty overview of C++ for experienced devs such as yourself.
http://www.stroustrup.com/Tour.html
>

>>51856354
You're kind of doing it wrong, anon. You're approach is called 'C with classes' and is antiquated. I'd recommend this approach instead:
// use -std=c++14

class Reindeer {
// ...
};

auto foo(/*...*/) {
/* create reindeer actor */
/*
Reindeer *ptr = (Reindeer *) malloc(sizeof(Reindeer));
char *str = (char *) malloc(sizeof(char) * strlen(nme));
strcpy(str, nme);
ptr->name = str;
ptr->speed = spd;
ptr->flight_time = f_time;
ptr->rest_time = r_time;
return ptr;
*/

Reindeer reindeer;

// set reindeer attributes, etc.

return reindeer;
}
>>
Suck with Server 2012 ! (for learning network manager)
>>
>>51856359
First, decide on a good GUI widget framework that works with you're language. For example, in you're using C++, then QT is the most popular choice.

From there, use the included designer tool to build the look of you're GUI items, say dialogs.

Then you use the appropriate mechanisms to hook the callbacks from you're GUI items events, say button-clicks, into you're code's functions.

I hope all that made sense anon. QT uses an approach for this they call 'Signals and Slots'.
>>
>>51856455
If you're going to work in a Windows(tm)(R)($) shop, then it's pretty much a given anon. Good luck.
>>
>>51856334
no worries ehh.
>>
File: cute anime pic 0608.gif (885 KB, 459x410) Image search: [Google]
cute anime pic 0608.gif
885 KB, 459x410
>there are people ITT who:
>use raw pointers
>use raw arrays
>use null-terminated char arrays instead of strings
>use raw arrays of pointers to null-terminated char arrays
>use raw pointers to raw arrays of pointers to null-terminated char arrays
>there are people ITT who spend hours writing 350 lines of C code to reproduce what a quick python script can do in 4 lines of code
>>
File: 1444675454882.jpg (149 KB, 1119x714) Image search: [Google]
1444675454882.jpg
149 KB, 1119x714
>>51856713
>There are people ITT who:
>can't into raw pointers
>cry about people using language they are too stupid to use
>can't comprehend that there are tasks that C is right language to use
>think that everything should be done in javascript/python
>>
Since I'm only an engineer I'm not very good at programming but I make do.
The last thing I did was program a microcontroller in C so it would work as a messenger between another microcontroller on an external board and some I2C devices on mine.
Next up is 2D pattern recognition in MATLAB.

Also I'm wondering how to improve my smartphone. I want two things (both from the homescreen):

1.
> pulling down from the top left corner brings up the notification drawer, pulling down from the top right brings up the quick controls (where you switch your WLAN / Location access etc.)
2.
> in the quick controls, long-pressing one of the symbols should take me to the appropriate settings
>>
>>51856794
engineering student *
pls help
>>
File: totaldestruction.webm (3 MB, 440x330) Image search: [Google]
totaldestruction.webm
3 MB, 440x330
Ask your beloved programming literate anything.
>>
>>51856207
>no anime face
>>
>>51856775
What the fuck, are pointers nowadays called "raw" because some other shit like "smart pointers" are available?
Fuck this shit, they're pointers since they point to memory and that's it.
>>
>>51857316
yes, they expose raw memory addresses given to you by your OS
the only thing rawer is writing your own kernel that accesses memory directly
>>
pid_t pid;

pid = fork();
if (pid == 0)
{ /* child process */
fork();
thread_create( . . .);
}
fork();


How many ORPHAN processes are created?
Then, how many UNIQUE threads are created?

This shit's driving me crazy..
>>
is there a general method for translating SQL queries with `having` to one's without?
>>
I just got started doing validation in a C# project.

I'm looking at regex now and it seems insanely complex, is there any resource that explains it in a way a moron could understand? the microshaft documentation isn't really helping.
>>
Just solved Day 14 AoC Part 1 in Lua in 34 lines of code, now trying to solve Part 2 but for some reason I'm getting a slightly skewed result against the example, gotta debug that bitch.
>>
>>51857202
Why haven't you killed yourself yet, Tetsumi?
Faggot.
>>
>>51857356
>expose raw memory addresses given to you by your OS

so virtual addresses, not physical ones


"virtual pointer" would be more suitable
>>
>>51857651
SELECT r.a, max(r.b) as m   
FROM r
GROUP BY r.a
HAVING count(*) > 2;
in equivalent without having
>>
I am learning C# because it is the basis of all modern programming, or so they tell me. I only want to made little 2D arcade like games, should I bother? If it is only going to be a hobby thing, should I instead use something with a front end like unity or game maker instead? I am not so good with logic I think. I am trying not to think about it too much.
>>
>>51857763
From perspective of the language, they are raw pointers pointing to raw memory space. What OS does with them is of no concern for programming language.

Particularly, calling them virtual is completely and utterly wrong because same code can be compiler for system with virtual and direct memory access.
>>
>>51857769
>learning C# because it is the basis of all modern programming
haha, they told you wrong. but it's a pretty good choice for you're usage in that case.
>>
>>51857768
select a,m from(
SELECT r.a, max(r.b) as m,count(*)
FROM r
GROUP BY r.a
) as x where count > 2;
>>
>>51857769
I'm pretty sure you'll still have to write c# code with unity.
>>
>>51856713
They're's certainly a good argument to be made about using native over interpreted, but you make a good 'point' about all the raw pointer use out there. Especially when they're's modern C++ available.
>>
>>51857850
someone tell this fag to tag

>>51857768
SELECT r.a, max(r.b) as m  
FROM r
WHERE (SELECT count(*) FROM r) > 2
GROUP BY r.a;
>>
>>51857316
For the same reason the term 'naked new' and 'naked delete' exist.

As to you're complaint, putting them within abstractions that afford RAII automatic resource management is generally the superior choice. Humans (especially C programming humans) have shown that they are often not very good at managing resources properly--especially during error conditions/states.

The runtime system never misses a beat with it. But you have to take proper advantage of that system first.
>>
>>51857672
Probably the pocket guide by Oreilly. Regex is very easily abused such that it becomes a write-only endeavor. That's no fault of MS, tbqh.
>>
Help

static unsigned int bit_mob0(const UINT64 p1,const UINT64 p0){// same as bitmob, only slower. But proven correct - only used to validate bitmob.
UINT64 fl1,fr1,ml1,mr1,s1,t;
fl1=p1|p0&p1<<8; fr1=p1|p0&p1>>8;
ml1=p0&p0<<8; mr1=p0&p0>>8;
fl1|=ml1&fl1<<16; fr1|=mr1&fr1>>16;
ml1&=ml1<<16; mr1&=mr1>>16;
fl1|=ml1&fl1<<32; fr1|=mr1&fr1>>32;
t=(fl1&p0)<<8 | (fr1&p0)>>8;
s1=p0&0x7E7E7E7E7E7E7E7E; // hor
fl1=p1|s1&p1<<1; fr1=p1|s1&p1>>1;
ml1=s1&s1<<1; mr1=s1&s1>>1;
fl1|=ml1&fl1<<2; fr1|=mr1&fr1>>2;
ml1&=ml1<<2; mr1&=mr1>>2;
fl1|=ml1&fl1<<4; fr1|=mr1&fr1>>4;
t|=(fl1&s1)<<1 | (fr1&s1)>>1;
s1=p0&0x007E7E7E7E7E7E00; // diag1
fl1=p1|s1&p1<<7; fr1=p1|s1&p1>>7;
ml1=s1&s1<<7; mr1=s1&s1>>7;
fl1|=ml1&fl1<<14; fr1|=mr1&fr1>>14;
ml1&=ml1<<14; mr1&=mr1>>14;
fl1|=ml1&fl1<<28; fr1|=mr1&fr1>>28;
t|=(fl1&s1)<<7 | (fr1&s1)>>7;
fl1=p1|s1&p1<<9; fr1=p1|s1&p1>>9; // diag2
ml1=s1&s1<<9; mr1=s1&s1>>9;
fl1|=ml1&fl1<<18; fr1|=mr1&fr1>>18;
ml1&=ml1<<18; mr1&=mr1>>18;
fl1|=ml1&fl1<<36; fr1|=mr1&fr1>>36;
t|=(fl1&s1)<<9 | (fr1&s1)>>9;
return((unsigned int)__popcnt64(t&(~(p0|p1))));
}
>>
>>51857955
So this... is the legendary C...
>>
File: production.png (5 KB, 392x46) Image search: [Google]
production.png
5 KB, 392x46
actual code just submitted at work for review
>>
>>51857989
What language is this
>>
>>51857995
Haskell
>>
public static void main(String[] args) {
System.out.println(fakultet(10));
}
public static long fakultet(long f){
if(f<1)
return 1;
else
return f*fakultet(f-1);
}
}


MAKE A RECURSIVE METHOD THAT COUNTS THE SUM OF ALL NATURAL NUMBERS UP TO n
spoonfeed me please
>>
>>51856207
Is setting a row of pixels faster or slower than drawing a line in c++.
>>
File: TLPI-front-cover.png (183 KB, 454x600) Image search: [Google]
TLPI-front-cover.png
183 KB, 454x600
>>51857617
this will clear everything up anon.
>
>>
hey guys average two ints xdddddddd
>>
>>51856794
I2C is pretty cool guy. Doesn't afraid of anything. I'd recommend you get urself a couple of Raspberry Pi 2s and play around with it some more anon.

As for you're phone setup question, sorry can't help much beyond saying that
>a) those are system config issues, so that's probably the best place to start
>b) you might be able to program you're own app that would enable that type of behavior (and sell it).
>>
File: chihaya hates being a vocaloid.jpg (54 KB, 468x340) Image search: [Google]
chihaya hates being a vocaloid.jpg
54 KB, 468x340
>>51857955
This is special.

I think the missing whitespace and MSVC++ specific intrinsics are a nice touch.
>>
>>51857955
you might consider just using asm embedded in you're other code anon?

If not, then at least categorize the operations and create some readable abstractions around it.
>>
>>51857989
>then true else false

Are you the famous CS Grad Guy?
>>
>>51857989
>then true else false

CS Grad Guy is that you?

>>51858068
row of pixels probably. and since you're probably using a graphics API of some sort, the calling language is of little import performance-wise.

As always, profile.
>>
File: f17486928.jpg (38 KB, 500x400) Image search: [Google]
f17486928.jpg
38 KB, 500x400
>>51857955
lol Nagasaki Hiroshima why do you're code block codes strike through shifts as if they were ancient posts?
>>
File: got_muh_eyes_on_you_faggot.gif (17 KB, 140x192) Image search: [Google]
got_muh_eyes_on_you_faggot.gif
17 KB, 140x192
>>51858072
>>
>>51857955
At least clean ur shit up first anon.
static unsigned int bit_mob0(const UINT64 p1,
const UINT64 p0) { // same as bitmob, only slower.
// But proven correct - only
// used to validate bitmob.
UINT64 fl1, fr1, ml1, mr1, s1, t;
fl1 = p1 | p0 & p1 << 8;
fr1 = p1 | p0 & p1 >> 8;
ml1 = p0 & p0 << 8;
mr1 = p0 & p0 >> 8;
fl1 |= ml1 & fl1 << 16;
fr1 |= mr1 & fr1 >> 16;
ml1 &= ml1 << 16;
mr1 &= mr1 >> 16;
fl1 |= ml1 & fl1 << 32;
fr1 |= mr1 & fr1 >> 32;
t = (fl1 & p0) << 8 | (fr1 & p0) >> 8;
s1 = p0 & 0x7E7E7E7E7E7E7E7E; // hor
fl1 = p1 | s1 & p1 << 1;
fr1 = p1 | s1 & p1 >> 1;
ml1 = s1 & s1 << 1;
mr1 = s1 & s1 >> 1;
fl1 |= ml1 & fl1 << 2;
fr1 |= mr1 & fr1 >> 2;
ml1 &= ml1 << 2;
mr1 &= mr1 >> 2;
fl1 |= ml1 & fl1 << 4;
fr1 |= mr1 & fr1 >> 4;
t |= (fl1 & s1) << 1 | (fr1 & s1) >> 1;
s1 = p0 & 0x007E7E7E7E7E7E00; // diag1
fl1 = p1 | s1 & p1 << 7;
fr1 = p1 | s1 & p1 >> 7;
ml1 = s1 & s1 << 7;
mr1 = s1 & s1 >> 7;
fl1 |= ml1 & fl1 << 14;
fr1 |= mr1 & fr1 >> 14;
ml1 &= ml1 << 14;
mr1 &= mr1 >> 14;
fl1 |= ml1 & fl1 << 28;
fr1 |= mr1 & fr1 >> 28;
t |= (fl1 & s1) << 7 | (fr1 & s1) >> 7;
fl1 = p1 | s1 & p1 << 9;
fr1 = p1 | s1 & p1 >> 9; // diag2
ml1 = s1 & s1 << 9;
mr1 = s1 & s1 >> 9;
fl1 |= ml1 & fl1 << 18;
fr1 |= mr1 & fr1 >> 18;
ml1 &= ml1 << 18;
mr1 &= mr1 >> 18;
fl1 |= ml1 & fl1 << 36;
fr1 |= mr1 & fr1 >> 36;
t |= (fl1 & s1) << 9 | (fr1 & s1) >> 9;
return ((unsigned int)__popcnt64(t & (~(p0 | p1))));
}
>>
>>51857907
> (SELECT count(*) FROM r) > 2
LOL
>>
File: can't mossad the assad.jpg (94 KB, 600x600) Image search: [Google]
can't mossad the assad.jpg
94 KB, 600x600
public class Rekursion {

public static void main(String[] args) {
System.out.println(factorial(10));
}
public static long factorial(long f){
if(f<1)
return 1;
else
return f==1 ? 1 : f+factorial(f-1); }
}

HELLO FRIENDS!
WILL THIS METHOD COUNT THE SUM OF ALL NATRUAL NUMBERS UP TO N OR HAVE I DONE SOMETHING WRONG LADS?
>>
>>51857225
Fuck off weeb
>>
>>51858297
>HAVE I DONE SOMETHING WRONG LADS?
Yes, you aren't using code blocks friend. Check the sticky.
>>
>>51858318
YES I COULDNT BE BOTHERED WITH THAT SHIT BUT IS THERE SOMETHING WRONG WITH THE CODE ITSELF??
>>
>>51858297
>>51858339
Oh, and you're shouting too.
>>
>>51857989
if X then true else false

kek
>>
    public void bubbleSort(){
int temp;
for(int i=0;i<52;i++)
for(int j=0;j<52-i-1;j++)
if(kort[j]>kort[j+1]){
temp=kort[j];
kort[j]=kort[j+1];
kort[j+1]=temp;
}
}

How do I change this method so that it sorts from largest to least instead of least to largest?
Thanks in advance, my best internet friends
>>
>>51858395
reverse the direction of you're loops, and then count downwards.

or, just use std::sort instead if it's for real work.
>>
UDP or TCP for gayms
tabs or spaces
++i or i++
how do i average two ints in C
why is fp so gay
why cant traps fuck off to >>>/lgbt/ and aniweebs fuck off to >>>/a/
>>
>>51858483
depends on the game
both
++i
using the most naive approach because who cares about overflows
idk
idk
>>
>>51858483
depends
depends
depends
lolwut
whocares
SJW invasion, and you do know you're on 4chan right?
>>
>>51858435
>or, just use std::sort instead if it's for real work.


>use the slower solution for real work
Truly Enterprisey.
>>
>>51858607
>bubble sort
>>
File: 1046.jpg (52 KB, 471x694) Image search: [Google]
1046.jpg
52 KB, 471x694
why does variable i equals 4 bytes when it contains entire var() function which have 4 strings with total size 16 bytes?
#include <iostream>
#include <cstring>
using namespace std;

int var()
{
string temp[4];
cout << "name of street where you live: \n";
getline(cin, temp[0]);
cout << "your age \n";
getline(cin, temp[1]);
cout << "rate your c++ skills [1 - 10]? \n";
getline(cin, temp[2]);
cout << "how long are you programming ? \n";
getline(cin, temp[3]);
cout << sizeof(temp); // this print out 16
return 0;
}

int main()
{
int i=var();
cout << sizeof(i); // this print out 4 explain this bullshit
}
>>
>>51856354
Why are you using malloc and strcpy instead of strdup?
>>
>>51858695
Are you retarded?

i is an int, which is 4 bytes in size.
>>
>>51858695
Easy. Your function i returns "0". Understand? Zero. "zero". That is 4 letters.
>>
>>51858695
This post is so indian I bet my poop is going to burn just from reading it.
>>
>>51858695
you're kind of thinking about it wrong anon.
int i = anything_in_the_world_youd_like();

will still only be a single int, as you've declared it to be.
(in this case a '0', since that's what you're function returns).

On you're system, apparently ints are 4 bytes in size (commonplace atm).

The memory layout of any function isn't generally relevant to the size of it's return either, but that doesn't matter since you've explicitly declared i to be an int. That means it's an int and only an int.

Hope that makes sense anon.
>>
>>51858741
kek
>>51858734
mfw a forgot about this
>>51858754
it's not indian code.
>>
>>51858741
>I... just.dont even...
>>
>>51858774
I said the post was indian, Harshveer.
How long are you reading comprehension?
>>
>>51858758
thx
>>
>>51857989
I hope you refactored that.
cores = bitmapFromArray . fmap (> 0)
>>
>>51856207
OP is, for once, fucking heterosexual
>>
Is there a GPU-accelerated ML library for haskell?
Are there recent benchmarks for the Accelerate backends in haskell? (latest is from 2011 and says that accelerate is garbage).
>>
>>51858695
Temp is an array (note: an array, NOT a pointer). 4*4 = 16. Int is an int, which is 4 bytes.
>>
>>51858607
std::sort is the fastest sort implementation in the world.
>>
>>51858862
just use python, haskell is literal garbage
>>
>>51858899
lol
>>
>>51858862
Apparently OpenCV now supports Clojure anon. Best I can think of.
http://docs.opencv.org/3.0-last-rst/doc/tutorials/introduction/clojure_dev_intro/clojure_dev_intro.html
>>
>>51858483
Depends
Tabs to indent, spaces to align.
++i since it always does the right thing, unlike i++.
Buy the patent.
Because it's mandated by IEEE754
Ask the bronies.
>>
>>51858785
gtfo
>>
>>51858906
Prove him wrong anon.
>lol
>>
>>51858918
go shit in the street
>>
>>51858910
OpenCV is to ML what scratch is to programming, if scratch weren't turing-complete.
>>
>>51858886
std::string is a wrapper class anon. they can be of any size whatsoever. an array of 4 of them can be of any size whatsoever x 4.
>>
>>51858945
No, std::string is a wrapper class which size is constant when the ABI is constant because lolpointers. Next thing you'll say is that unions are not of constant size.
>>
>>51858931
go watch anime
>>
>>51858960
so discuss the memory layout, first to last, of any given instantiation of a string anon.
>>
>>51858962
I don't watch cartoons.
>>
>>51858916
The patent is for doing it with one opcode / hardware. You are free to use the algorithm.
>>
File: 1450069756653.png (284 KB, 736x736) Image search: [Google]
1450069756653.png
284 KB, 736x736
>>51858962
even cats can poo in loo, why can't you ???
>>
>>51858993
Shitpaws.
This is the /dog petting thread/, please cease and desist.
>>
>>51858999
>chkd
>>
>>51858977
Irrelevant. Just this once I'll spoonfeed you.
typedef struct {
char* c;
size_t l;
} string;
std::cout << sizeof(string()) << std::endl;
-| 8
auto s = string();
s.c = "hello world";
s.l = 9999999;
std::cout << sizeof(s) << std::endl;
-| 8

Nothing requires the length to be part of the string.
>>
>>51858983
i missed point here
>>
>>51859022
>Irrelevant
Wrong again, but meh. Enjoy mediocrity, but pls stay away from library writing anon.
>>
>>51859041
I guess it was useless to try to educate a clinical retard. Oh well, that'll teach me to try and spoonfeed I guess.
>>
Why this code prints out memory addres instead of text?
#include <iostream>
#include <cstring>
using namespace std;


int main()
{
//int i=var();
char foo[6][15]={{'j','a','n'},{'p','a','w','e','l'},{'d','r','u','g','i'},{'g','w','a','l','c','i','l'},{'m','a','l','e'},{'d','z','i','e','c','i'}};
cout << foo;
}
>>
>>51859085
because foo is a char**, ie, an address.
>>
>>51859097
i don't understand
>>
>>51859085
stop writing C as if it were C++ anon. you annoy us, and shoot you'reself in the foot.

pick one or the other yea?
>>
>>51859104
foo is just the address.

foo[x][x] are elements.
>>
i want to start automating tasks.
like formatting windows, and installing everyhting i need into this new install .
would settle down for just the second part.
how do you guys think i should procede with that.
>>
>>51859085
wstyd mi za wszystkich polakow jak czytam twoj kod, taki z ciebie debil
>>
>>51859120
so how to print entire text?
>>
>>51859148
You need to print each element individually
>>
>>51859104
you should just use std::string if you're going to do C++ anon.

#include <iostream>
#include<vector>
#include <string>
using namespace std;

int main() {
vector<string> data{"jan", "pawel", "drugi", "gwalcil", "male", "dzieci"};

for (const auto& e : data) cout << e << '\n';
}
>>
>>51859130
learn powershell
>>
>>51859182
oh right, powershell is integrated into windows.
is it integrated into win 7 and XP or any older systems.
i want something that would help me out from atleast 7 and later on.
having XP support would be great as well.
>>
>>51859202
it's available at technet for older platforms
>>
>>51856207
FOR FUCK'S SAKE LINK THE THREAD FUCKING RETARDS

KILL YOURSELF FAG
>>
>>51859221
fuck off. i'll never link to trap threads anon.
>>
>>51859239
AT LEAST LINK TO HERE FROM THE TRAP THREAD SO PEOPLE CAN MIGRATE

FUCKING IDIOT
>>
>>51859248
i'll think about it.
>and nou lol.
>>
I gotta do a group project in Java for a uni course. It hurts. I haven't touched Java in 3+ years.
>>
>>51859282
Ohh a negative comment about Java. Earning your /g/ street cred well today :)
>>
>>51859221
what's with this retard?
>>
At least this thread isn't unironically getting baited into a "discussion" about how FP is useless.
>>
File: bglisp.jpg (42 KB, 500x225) Image search: [Google]
bglisp.jpg
42 KB, 500x225
>>51859315
It is.
>>
>>51859282
you have muh feels

>>51859315
>FP
literally who?
>>
>>51857874
>They're's
epic
>>
>>51859315
there's nothing to discuss about it. it's a fact that FP is useless.

do you have discussions on whether or not the sky is blue, anon?
>>
>>51859298
It's not a negative comment about Java. It's a comment about how I feel it's a daunting task to remember how it's done in Java.
>>
>>51859322
>>51859323
>>51859328
Guaranteed replies. Why are anti-FPers so angry all the time?
>>
>>51859315
better than "average 2 ints or go flippin burgers xddddddddddddddddddddddddddddd"
>>
>>51859343
you're new at this aren't you anon?
>>
>>51859322
recursion is for fucking fags that think they're so clever for using such a "trick". the natural (naive) way to compute fib(n) would be to go from 1 to n like 1 1 2 3 5 8 13 21 etc using normal iteration. not fucking backwards using recursion; try writing it out on paper, it's a fucking ridiculous and inefficient concept.
>>
>>51859355
No, I'm just becoming more and more suspicious that people actually believe stuff like this: >>51859369
>>
>>51859343
kill yourself you unjustifiably smug prick
>>
>>51859380
>being this delusional
it's not a matter of belief. it's fact.
>>
>>51859380
you must be trolling. recursive fibonacci is several orders of magnitude slower than iterative.
>>
>>51859369
CURRENT_YEAR > 1980
>using compiler that does not support tail call optimization

Holy shitcunts gramps can you stop living in the past?
>>
>>51859402
RETARD I'M NOT EVEN TALKING ABOUT THE PROGRAMMING ASPECT OF IT

I'M TALKING ABOUT THE "INTUITIVE" WAY TO COMPUTE IT

AND THE COMPILER CAN'T FIX YOUR RETARDED "ALGORITHM"
>>
>>51859396
Sure, if it's done naively. With a histomorphism recursion scheme (automatic memoization) it's trivial to implement in O(n).
fib :: Int -> Int
fib = histo phi where
phi [] = 0
phi [_] = 1
phi (x : y : _) = x + y
>>
>>51859168
>This one is a honeypot for faggots, leave it be anon.
sorry anon, you were right. I shouldn't have linked to this thread...
>>
>>51859422
KILL YOURSELF
>>
File: 1444350997526.jpg (11 KB, 250x244) Image search: [Google]
1444350997526.jpg
11 KB, 250x244
>>51859396
>>51859422
And the best part is that because of purity, "histo" could simply be implemented to store and reuse the list of results that it internally generates.

>>51859435
>>
>>51859435
>being this mad that you can't think recursively
Pajeet have you ever thought that programming is not for you?
>>
>>51859454
>>51859457
fib(8) using iteration: 1 1 2 3 5 8 13 21

fib(8) using recursion:
fib(8) = fib(7) + fib(6)
fib(7) = fib(6) + fib(5)
fib(6) = fib(5) + fib(4)
fib(5) = fib(4) + fib(3)
fib(4) = fib(3) + fib(2)
fib(3) = fib(2) + fib(1)
fib(2) = 1
fib(1) = 1
fib(3) = 2
fib(4) = 3
fib(5) = 5
fib(6) = 8
fib(7) = 13
fib(8) = 21

which is more elegant and useful?
>>
>>51859502
Using a histomorphism is the exact same thing as doing it with iteration, except the memoization is handled automatically.
>>
>>51858815
No, I'm busy with own shit and it's minor, it's now in master ;^)

I'll fix it when I'm in the module and can remember.
>>
>>51859457
>being THIS smug about being able to think recursively

you are not smart for thinking recursively, fucking pleb.
>>
>>51859528
Not him, but recursion can easily give you the performance of iteration while being far simpler to write (no juggling accumulators, stacks, etc.)
>>
>>51859546
k tard
>>
Made my first django app. It's awesome you can get an admin section in like 5 commands.
>>
>>51859523
>I'll fix it when I'm in the module and can remember.
what company are you at anon? i just ask because i'm currently looking for work, and i'd like to steer clear of it.
>>
>>51859563
it's a popular framework
>>
>>51859563
>django
they should move to a typed, faster language already...
>>
how do i average two ints in C
>>
>>51859562
Are you trying to false flag anti-FP as being universally too stupid to come up with an argument to support their beliefs? Because you're doing a good job.
>>
>>51859613
the same way you do in java anon, with the avg() function.
>>
>>51859613
you kill yourself ASAP. quantum mechanics will do the rest, magically.
>>
thanks for all the bumps faggots. and the entertainment as well.
>im off have fun
>>
>>51859616
cool story fag
>>
>>51859572
secret~

For real though you really don't want to be switching branches mid-work, build and having to run through all the CI stuff just to validate a one line change that you can fix next time. We're pretty busy these days.

– posted during my build
>>
>>51859621
https://docs.oracle.com/javase/7/docs/api/java/lang/Math.html
>no avg
WE'RE DOOMED
>>
>>51859613
average = (a>>1) + (b>>1) + (a & b & 1)
>>
>>51859651
only works for positive numbers
>avg(-2, -1)
>-2
>>
>>51859674
It's rounded you idiot.
>>
>>51856207
Hello /g/, can anyone help me with some C programs?
It is very urgent and I promise I will make it worth you while if you help me, just give me your Steam ID.

First one is:
Write function formarray which on array's position where the minimums are maximum's get written and vice-versa.
Within the function formarrat call for funcion minmax which returns the minimum by the reference of maximum.

Write a C program which allows input of the entire number aray X of n element, and then calling for function formarray which dpes the transformation of the array.


Excuse me for my bad English (translating), I'm Polish/Russian
>>
>>51859674
int average(int a, int b)
{
int x = (a & b) + ((a^b) >> 1);
return x + (1 & (a^b) & (x >> sizeof(int)*8-1));
}
>>
>>51859725
>pls zrobcie za mnie prace domowo
>>
>>51859807
My mum is Polish, I only speak Russian
sorry anon
>>
File: Java.png (39 KB, 518x518) Image search: [Google]
Java.png
39 KB, 518x518
Baby-tier beginner here, currently learning Java. Not sure if going to stick with this one, but I have a dilemma. Job market-wise, should I:
a) grind one language until well above average skill
b) learn parts of 2/3/4 languages that differ from each other to become more versatile
>>
>>51859899
Both
>>
>>51859724
it's supposed to be rounded toward 0, not toward negative infinity, you idiot
>>
File: 1403837987365.png (48 KB, 400x389) Image search: [Google]
1403837987365.png
48 KB, 400x389
>/g/ can't average two ints
>>
>>51859996
wut
>>
>>51859987
>A or B
>both

fuck off
>>
>>51859746
>average(-2, 1)
>0
u wot

>>51859996
it's not as easy as you would expect

let's see you do it
>>
>>51860043
>u wot
never mind that's actually correct, i thought i had it set to average(-2, -1)
>>
>>51856324
A segmentation fault is basically you attempting to access data that you have been locked out of. Like when trying to access dynamic addresses from within a loop. Or like trying to access a thread that closed before you reached the thread.join call in your code.
>>
>>51859144
ale na wykop to ty wkurwiaj
>>
>>51859169
thx man
i respect /g/ for fast explantation some shit which i dont understand at all
>>
What GNU/Linux distro do you guys use?
>>
File: image_5.jpg (38 KB, 500x284) Image search: [Google]
image_5.jpg
38 KB, 500x284
>>51856794
Fucking MATLAB
>>
how to obfustace c++ code so it will be not visible for antyviruses?
>>
>>51860268
NOT.
PROGRAMMING.
>>51860291
NOT.
EIGHTEEN.
>>51860257
NOT.
A PROBLEM.
>>
>>51859144
>>51860240
>mfw this is an actual language
>>
>>51860291
they probably won't detect it by default and then once it's been found it they will update them to recognize whatever it is that it is
>>
>>51860346
Well said, friend. Well said.
>>
So Advent of Code is down today?
>>
we polish now?
>>
>>51860430
Been up until recently but the server went down for some reason. I still have a tab open so here's the description & sample in case you want to implement it now and submit once the website is back up: http://pastebin.com/raw.php?i=e3J1Hf7k
>>
>>51859651

Hey guys, was looking around on stack overflow, and apparently someone patented this in 1996.

This raises a question though -- if the compiler generates equivalent code from using modulo and division operators, is it still illegal?
>>
>>51860457
Thanks!
>>
>>51860460
The patent is for a way to this in one operation / hardware. The algorithm itself is not patented.
>>
>>51860291
>antovorisus don't work that way mate
>>
>>51860484
How about you go obfustace yourself.
>>
>>51860444
Which one are worse programmers?
Poland or India?
>>
>>51860517
india
>>
>>51860517
I don't know, I'm Polish but my sample size is 1 (me) and I think I do much better than Indians.

Oh I lie, I was overseeing someone's work during summer and he was Polish and his code was pretty good.

Indians just write trash AFAICT.
>>
>>51860540
why?
is it a /g/ meme or something like this?
>>
>>51860481

Oh, seriously?

Why the hell would anyone want to dedicate an opcode just for integer averaging?
>>
>>51860551
i bet you are from wykop
pope is a guy who lives in rome
>>
>>51860566
in a single instruction cycle*
my mistake
>>
>>51860566
Not sure if retarded or just tripfag.
>>
File: a ruff victory.jpg (65 KB, 500x368) Image search: [Google]
a ruff victory.jpg
65 KB, 500x368
>>51860616
Both.
>>
File: plebs.jpg (91 KB, 700x450) Image search: [Google]
plebs.jpg
91 KB, 700x450
>>51860554
indians are legit stupid as shit. it's a third world country and a lot of people literally shit in the streets. even the ones that aren't complete poorfags have shitty DNA and eat food that lacks in nutrition. in their culture it's normal and accepted to tell lies and defraud people. their education focuses on memorizing things, they can't think for themselves. you can teach them to do simple code monkey tasks and that's it. gypsies which are the plebbiest of plebs and do nothing but steal, lie and destroy, originate from india. for a country with a population of that size there is very little innovation and productivity coming out of india.
>>
>>51860593

Unless it was implemented in hardware, it would not execute in one cycle.
>>
>>51860698
seems to be the case, then.
>>
>>51856207
I was working on making a blog for myself, but seeing how that will take forever to actually start doing it, I don't really have anything I am working on right now senpai.
>>
My question is why 4chan is being a botnet and censoring a whole bunch of words like

kek and senpai
>>
>>51857989
The only reason why Haskell code was typically better than Java is because Haskell has less users.
>>
>>51860790
Because hiroshima nagasaki is a massive kek and wants to sanitize the site so it's easier to sell everyone's data. Notice also how many, many on-topic threads and posts site-wide are being deleted, while pure shitposting is always allowed to stay up until the bump limit. This is another tactic to dilute the site.
>>
>>51860790
>>51860819

Word filters have been around for a loooooong time anon. Fuckin' roodypoo candyasses.
>>
>>51860572
I've gone on that site like once in my life few years ago, I don't tend to associate with PLs.

>>51860798
I love memes too.
>>
>>51860790
>being this new

but I wonder why they deleted one of my posts, in which I told the OP of one dpt to go to >>>/a/ and >>>/lgbt/ , and said "sage goes in all fields".
>>
>>51860790

Hiroshi arrived and the very next day decided he didn't like the mean words that people were saying.
>>
>>51860822
Only on /b/, where they belong, and never site-wide. Moreover, moot kept bringing in more and more filters over the years because he's a double kek. Filters that initially autobanned you, often on false-positives.
>>
>>51861201
they should censor "libertarian", "christian", "anarchist", "statist" and "capitalist"

also, "anime" and "trap"
>>
>>51861254

But I'm not a christian. :^)
>>
>>51861120
You'd know if you weren't this new.
>>
>encode a 7 card hand in 40 bits
is this supposed to be hard?

14 bits for the suits (2 bits per suit)
26 bits to store a base 13 number

or just store a 40 bit base 52 number
>>
Just started reading Java a beginner's guide 6th edition, so nothing. Working on nothing. First language I'm learning. Hope to be able to make vidya and other cool apps for android.
>>
File: 123104333990373876869458.jpg (27 KB, 530x567) Image search: [Google]
123104333990373876869458.jpg
27 KB, 530x567
>>
File: giphy.gif (969 KB, 500x281) Image search: [Google]
giphy.gif
969 KB, 500x281
http://www.sigbus.info/how-i-wrote-a-self-hosting-c-compiler-in-40-days.html
>>
>>51861407
Faggot*
>>
>>51861407
this is what C#fags actually believe
>>
>>51861438

u mad, ctards?
>>
>>51860790
go prep your cracker bull, cluck
>>
If your favorite book isn't The Art of CP, you don't know SHIT about computer programming.
>>
>>51861513
Reported to the FBI.
>>
>>51861412
>unironically writing a compiler in C
Fucking why
>>
>>51861307
>muh rules
but I was right.

>>51861513
>The Art of CP
pedo
>>
REMINDER THAT THIS COMPILES ON GCC
int main()
{
int (*){} ayyyyyyy
}
>>
File: sadloli.png (570 KB, 1080x1600) Image search: [Google]
sadloli.png
570 KB, 1080x1600
>>51861513
>The Art of CP
it's a reference book that is a lot more about _computing_ than programming. it's getting old now. (Donald knuth doesn't believe in concurrency and parallelism).
>>
Trying to make a Cinnamon applet for Mint that displays a simple countdown in my tray but I cant find any fucking docs or examples??? What is this meme wm desu
>>
>>51861586
>Donald knuth doesn't believe in concurrency and parallelism
what a shitter
>>
>>51861574
Nope.

test.c: In function ‘main’:
test.c:3:11: error: expected identifier or ‘(’ before ‘)’ token
int (*){} ayyyyyyy
^
test.c:3:15: error: ‘ayyyyyyy’ undeclared (first use in this function)
int (*){} ayyyyyyy
^
test.c:3:15: note: each undeclared identifier is reported only once for each function it appears in
test.c:4:1: error: expected ‘;’ before ‘}’ token
}
^
>>
>>51861574
do you faggot have a list of memes or something? are you the same faggots that tries to make trap threads all the time?
>>
>>51861632
http://ideone.com/pSWP0a
>>
#define lest(name) if (!name)
>>
>>51861646
>C++14
idiot
>>
>CL has exactly one relevant ML library
>hasklel has over a half dozen
>CL is still 100x more relevant in ML than hasklel
>hasklel's libraries are literally unusable
>CL's was used in winning kaggle entries, e.g. to classify higgs bosons
>>
>>51861646
that's g++
>>
>>51861649
#define + -
>>
Hi everyone,
I want to make a bruteforce program in Python (for educational purposes, I'm trying it on my own files) that tries out different passkeys in an attempt to get access to an ecrypted TXT file which was issued by AxCrypt.
However, I cannot access the AxCrypt interface using command-line.
The password must be inserted in a graphical window.
How can I make a program that automatically focuses the AxCrypt window and pastes in the passwords one by one?
>>
>>51861438
What do they believe exactly?
>>
File: quite a ruff victory.jpg (46 KB, 653x510) Image search: [Google]
quite a ruff victory.jpg
46 KB, 653x510
>>51861757
That they're actually software developers.
>>
>>51856207
Any other CS grads here? Just finished this bad boy, looking for some other projects to do to pad my résumé.
bool even(int x)
{
string xx = x.ToString().SubString(x.ToString().Length - 1, 1);
if ( xx == "0" || xx == "2" || xx == "4" || xx == "6" || xx == "8") {
return true;
}
return false;
}
>>
Why should I
#include <sys/param.h>
?
>>
>>51861793
You don't have to do anything that makes you feel uncumfortable anon. This is a safe place.
Thread replies: 255
Thread images: 29

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.