[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: 46
File: projects.jpg (475 KB, 1920x1080) Image search: [Google]
projects.jpg
475 KB, 1920x1080
Productive edition
>>
>>52346599
D
>>
anyone have other versions than v.1.3 (like in OP), v1.4 and v2.0?
>>
Notice how we managed to wait till bump limit because >>52342288 has gone to bed.
>>
First for averaging two bools in C.
>>
I was expecting a trap thread or an anti trap thread. Will this be the thread /dpt/ has dreamed of?
>>
>>52346627
Sad thing is, that was 6 hours and 40 minutes ago, he'll be awake in time to make the next thread.
>>
Meme languages

>Python
>Haskell
>?
>>
>>52346650
i don't think you know what meme means.
>>
What's the is the difference between 'open' and 'import' when selecting a project in ide's?
>>
>>52346668
I know, thanks.
>>
>about to end college
>got told about Java jobs
>hate Java
>look into Java, it's super ez
>Look into JavaFX
>Also ez, and due to latest updates to the Java engine not as slow as 1999

So, my college is about to end and I got myself a job in Java.
I used to think it's a meme language but it's so easy and makes me fuck tons of money.

Who /java/ here?
>>
File: 1452433218753.png (520 KB, 1065x575) Image search: [Google]
1452433218753.png
520 KB, 1065x575
Is it normal to keep thinking, "I'll refactor that later", then end up with a complete mess but you don't really care because it works?
>>
>>52346707
Get out
>>
>>52346719

Yeah, that sounds about right.
>>
>>52346719
That's how Java is created :^)
>>
>>52346707
rajesh pls
>>
>>52346707
still a student but I've done an enterprise java dev internship so if I need to I should be able to at least fall back on being a poo in loo dev.
>>
>>52346707
Go for it

I know some experienced java dev's who are swimming in money.
>>
>>52346719
>GUI events in Java
>Make anonymous classes
>I should make class files because it's getting bloated
>Nah, fuck it
>>
>>52346719
if the interfaces are clean then you should be alright for now. however when you come back to it later it's going to be fucked.

what's so hard about writing clean code from the start?
>>
>>52346724
Buy why anon?

>>52346756
Nice, I have to wait for legal stuff to finish for my college.

>>52346773
Yeah I will make €56K/year as starter
>>
>>52346777
because it makes it more annoying to focus on the big picture when you're constantly trying to clean up the small details first.

its why any decent artist always blocks out their paintings/sketches first.

get everything working first, then go back and refactor, then add new shit, then refactor the new shit, repeat.
>>
>>52346816
>56k

Not sure what country u in but the devs i'm talking about plow 70K-90K in Brussels. I mire them with my Cisco certs making 50K plugging cables and telling ppl to reboot their shit
>>
>>52346853
The Netherlands
That said 56K for a 19 y/o isn't that bad.
>>
what does /dpt/ think of limetext?
>>
I've been trying to simulate a keyboard keydown/keyup event in C#/WPF

I've got a global listener, but I want to now simply emulate a different key being pressed.

How in the fuck do I achieve this?

I've tried using InputSimulator but it doesn't work at all, the entire thing appears to be completely hollow (none of the classes have any members, even though they appear in references just fine).

I can't think of any reasonable way to achieve this behaviour.
>>
>>52346679
Bump

>tfw askin myself y u fucks wont reply
>>
>>52346894
The aim of my program is to delay the "keyup" event somehow.

I went with registering a global keyhook, reading that input and then emulating a keydown event, then when the keyup event is called wait for a specified period of time then have the keyup event play.

But I have literally no idea how to get this to happen.
>>
>>52346894
not even joking just use a python import

import pyautogui
>>
File: c71.jpg (20 KB, 334x393) Image search: [Google]
c71.jpg
20 KB, 334x393
>>52346929
>In C#/WPF
>Python
>>
>>52346874
>That said 56K for a 19 y/o isn't that bad.
..Most adults 25+ don't even make that much.

No idea how you even came to the conclusion that someone nearly fresh out of highschool making almost 60k a year is only considered "not that bad". The fuck
>>
Coding a morse teaching machine on python.
>>
What was the plugin called to remove the captca field in reply forms on 4chan?
>>
>>52346968
4chan jew
>>
>>52346953
>what is binding
>>
>>52346627
>>52346649
Not that ban's do much, but why isn't he banned and his threads deleted on sight?
>>
>tfw didn't graduate and the only IT contract I could get is only £16.5k pa
Study hard lads
>>
>>52347007
thats like minimum wage m8
ouch
>>
Just solved the Euler 5 problem, but can't get a list as input for a command ((alcm(*args) below)). Anyone who knows why it gives me a list in return instead of an answer?

from math import gcd
from functools import reduce

n = 10

def lcm(a,b):
"Calculate the lowest common multiple of two integers a and b"
return a*b//gcd(a,b)

reduce(lcm, range(1,n+1))
reduce(lcm, range(1,n*2+1))

def alcm(*args):
"use lcm function on multiple args"
return reduce(lcm, args)

lst = list(range(1,11))

print(alcm(1,2,3,4,5,6,7,8,9,10))
print(alcm(lst))


giveth:

2520
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>
My current method for emulating a key down/up event. But it doesn't work.

Why is this such a fucking pain in the dick?

        public bool isKeyDown = false;
void KListener_KeyDown(object sender, RawKeyEventArgs args)
{
if (args.Key == Key.C && isKeyDown == false)
{
isKeyDown = true;
Console.WriteLine("key is down");
SendDown(Key.E);
}
}

async void KListener_KeyUp(object sender, RawKeyEventArgs args)
{
if (args.Key == Key.C)
{
isKeyDown = false;
Console.WriteLine("key is up");
await Task.Delay(5000);
SendUp(Key.E);
}
}

public static void SendDown(Key key)
{
if (Keyboard.PrimaryDevice != null)
{
if (Keyboard.PrimaryDevice.ActiveSource != null)
{
var e1 = new KeyEventArgs(Keyboard.PrimaryDevice, Keyboard.PrimaryDevice.ActiveSource, 0, key) { RoutedEvent = Keyboard.KeyDownEvent };
InputManager.Current.ProcessInput(e1);
}
}
}

public static void SendUp(Key key)
{
if (Keyboard.PrimaryDevice != null)
{
if (Keyboard.PrimaryDevice.ActiveSource != null)
{
var e1 = new KeyEventArgs(Keyboard.PrimaryDevice, Keyboard.PrimaryDevice.ActiveSource, 0, key) { RoutedEvent = Keyboard.KeyUpEvent };
InputManager.Current.ProcessInput(e1);
}
}
}
>>
>>52347036
slightly higher. Minimum in UK is £6.70/h. I get £7.46/h, which sadly enough is lower than my previous sainsburys (convenience store) wage of £7.75/h
>>
File: g.jpg (45 KB, 1814x224) Image search: [Google]
g.jpg
45 KB, 1814x224
halp
>>
what is this meme language that looks like python with type hints
>>
>>52347050
The following indicates that you are potentially passing multiple values in, and then puts them in a list
def alcm(*args)

The following passes only 1 argument (a list) into that function
print(alcm(lst))

The following unpacks the list so that all the values inside are submitted as arguments
print(alcm(*lst))
>>
>>52347112

sinh doesn't accept a value?

no idea nigguh, what language are you using?
>>
>>52347112
> ->
>first character of primitive is uppercase
What am I looking at?
>>
>>52346599
reroll
>>
>>52346599
roll
>>
>>52347139
Swift, apparently it's bugged or something idk
>>
>>52347068
    public partial class Form1 : Form
{

private const int APPCOMMAND_VOLUME_MUTE = 0x80000;
private const int APPCOMMAND_VOLUME_UP = 0xA0000;
private const int APPCOMMAND_VOLUME_DOWN = 0x90000;
private const int WM_APPCOMMAND = 0x319;

[DllImport("user32.dll")]
public static extern IntPtr SendMessageW(IntPtr hWnd, int Msg,
IntPtr wParam, IntPtr lParam);

public Form1(string fn)
{
InitializeComponent();

}

//Global hotkey
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == (Keys.Down))
{
SendMessageW(this.Handle, WM_APPCOMMAND, this.Handle,
(IntPtr)APPCOMMAND_VOLUME_DOWN);
return true;
}
if (keyData == (Keys.Up))
{
SendMessageW(this.Handle, WM_APPCOMMAND, this.Handle,
(IntPtr)APPCOMMAND_VOLUME_UP);
return true;
}
if (keyData == (Keys.M))
{
SendMessageW(this.Handle, WM_APPCOMMAND, this.Handle,
(IntPtr)APPCOMMAND_VOLUME_MUTE);
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}

}
>>
reading sicp and programming in racket lol
>>
>>52347112

Do cosh and tanh work? If so, sinh(x) = cosh(x)/tanh(x).
>>
>>52347284
I've already got a global key listener.

What I need to do is emulate a key being pressed.

So when I press C it'll emulate the "down" event of the E key, and then when I release C it'll emulate the "up" event of the E key.

I'm not sure why it's so hard to emulate a keyboard input.
>>
>>52347284
This reminds me of the time I wrote a snes controller -> keyboard application and the emulator wouldn't recognise the keypresses because the c# method for it (sendkeys is it?) was shit, had to find out what the on screen keyboard used and replicate that instead.

To be fair to it, should have just used an ftdi and made it a game controller but it was for learning.
Still shit though.
>>
>>52347291
apparently no normal hyperbolic function is working, but acosh, atanh and asenh are working, am I kill?
>>
>>52347297
noice one lad
>>
>>52347329
don't know the solution but I hope you've properly abstracted your class as a AsyncKeyInputObserver or equivalent using the observer pattern and subclassing for the KeyboardAsyncInputObserver
>>
>>52347344
I'd be fine using SendKeys if it even existed.

I can't seem to use System.Windows.Forms (apparently it doesn't exist for some unknown reason)
>>
>>52346599
Let's roll
>>
LINUX SOURCE CODE LEAKED:
https://github.com/torvalds/linux
>>
>>52347068
You have to use "keybd_event"
>>
>>52346599
How come ocaml is the best language by far? First, lisp is a much more solid concept; second, haskell has tons of hype. Yet, they both suck dicks in practice; but ocaml is fantastic. What is this bullshit?
>>
>>52346894
You're going to need to use

 [DllImport( "user32" )] private static extern bool PostMessage(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam);


Study how windows messages work and you'll know what you need.
>>
>>52347399
Where?

None of this code makes any sense any more, because I've gone through so many different iterations and solutions that none of it even lines up in my head.
>>
File: ygi.png (36 KB, 567x269) Image search: [Google]
ygi.png
36 KB, 567x269
Well, I think it's time to move on to something else if I'm honest.
>>
>>52347421
http://www.pinvoke.net/default.aspx/user32.keybd_event
>>
>>52347381
There is an example solution floating around somewhere dedicated to sendkeys, i know because i initially used it thinking i'd fucked up somehow for the aforementioned emulator reason, it does press the keys but it doesn't do it in the same manner as an actual keyboard, making it shit. Go with the dll method, it just werks.
>>
>>52347354

Yup.
>>
>>52347390
fuck I haven't kekd so hard in a long time!
>>
>>52347473
>>52347450

If only I understood it.

I barely understand the C# syntax, Win32 programming syntax is an absolute mess.
>>
>>52347438
How do you even get JavaScript to create directories and download files? I thought that was something you can't do because of security reasons?
>>
>>52347514
webcache.
>I thought that was something you can't do because of security reasons?
How do you think all those javascript downloaders work?
>>
>>52347500
There's example code on the page
You only have to specify 2 of the 4 values
(or 3 if you want it to work with everything)
>>
>>52347563
Why is it such a roundabout bloated method simply to simulate a keyboard event?

What a completely retarded implementation of such a simple feature.

I imagine other languages probably have better implementations than microshaft do in their own OS.
>>
File: 1452427188248.png (87 KB, 223x187) Image search: [Google]
1452427188248.png
87 KB, 223x187
>>52347514
I used the Chrome API.

https://developer.chrome.com/extensions/downloads
>>
>>52347500
>Win32 programming syntax is an absolute mess.

You'll learn to love it. It's a bit like stockholm syndrome.
>>
>>52347636
It's hardly stockholm syndrome, I'm chasing it but it just keeps evading my grasp.

It's just a fuckload of syntax I don't understand using Ascii codes I don't remember.

Like in this specific case, how do I emulate the "E" key?

What is the code for designating keydown and keyup?

How would I make this customisable?

It's an absolute fucking mess.
>>
>>52347600
It's not really that bloated
Only 2 redundant parameters out of 4
>>
>>52347676
>using Ascii codes I don't remember.
Not him, but you do know about the ord and chr functions right?
>>
>>52347676
I believe you can use System.Windows.Forms.Keys as the first parameter
KEYDOWN is 0
KEYUP is 2
>>
>>52347684
Nope, never needed them, I've been blissfully enjoying my relatively simple C# syntax, if I ever needed Win32 stuff I'd go directly to a source and copy the whole thing into a class and forget about it.

Now I'm forced to interact with this horrible shit.

Just need to find the KeyDown code.
>>
>>52347676

Take a look here: https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx

On that note, the others are correct... take a look at PostMessage.
>>
>>52347636
I for one am being held hostage by visual studio, shes a fat whore but my god man that bitch is comfy.
I did some work on byonds DM language a while back (spess) and it was like working in fucking notepad, i was on cold turkey from intellisense and good god man was it awful.
>>
>>52347707
You could try MonoDevelop
I switched 2 months ago and prefer it to Visual Studio ...after writing an AddIn to fix annoying shit
>>
>>52347741
do they have a design view yet? With an actual designer? It's all I ask for.
Last i checked it just had a design view button that didn't actually do anything, I was not amused.
>>
>>52347753
I don't know, sorry
I do all UI stuff in code
>>
>>52347483
fug
>>
if i am a beginner and i learn my first language
How long would it take to learn a framework?
>>
File: 1450044669784.jpg (346 KB, 736x1044) Image search: [Google]
1450044669784.jpg
346 KB, 736x1044
>>52348146
If you know the language you can use any framework straightaway, you just need to learn the function names which you can easily find out in the framework's documentation.
>>
>>52348146
they're completely different beasts

learning a first language in its simplest level is just understanding how different concepts operate with each other, whether these concepts are variables, functions, classes, etc. At a more advanced level, it's using tricks accumulated through seeing other's code, your own optimizations, as well as learning how to use specific libraries to achieve what you want

learning frameworks is somewhat equivalent to learning a language at its more advanced level. It's almost the same as learning libraries in and out, but you need efficient use of the tricks previously mentioned since your code will be all over the place, and lack of clear structure will frustrate you quickly
>>
File: sql.png (133 KB, 1076x1300) Image search: [Google]
sql.png
133 KB, 1076x1300
MySQL is nice.
>>
>>52348229
Not always. Some frameworks have their own DSLs or pretty much rewrite the whole parent language, which might as well be called a DSL.
>>
>>52348282
>declarative programming
not even once
>>
How do I get a usable VirtualKeyCode from a KeyDown event?

I used this to get an int, but it doesn't seem to be correct or in any way useful.
        private void txtInput_KeyDown(object sender, KeyEventArgs e)
{
if(txtInput.IsFocused)
{
txtInput.Text = KeyInterop.VirtualKeyFromKey(e.Key).ToString();
}
}
>>
File: 1452445960642.png (462 KB, 567x748) Image search: [Google]
1452445960642.png
462 KB, 567x748
How do I learn JavaScript senpai?
>>
>>52348282
>Using SQL to make that shit

What the fuck
>>
File: copy_challenge.jpg (96 KB, 1131x1599) Image search: [Google]
copy_challenge.jpg
96 KB, 1131x1599
I give up...
all i could get for container 1 was:

$ vim test2.py
$ python test2.py
item 1 : 94 pcs
item 2 : 94 pcs
item 3 : 94 pcs
something remains, nigger!!! 0.14000000000000057
>>
>>52348439
With lots of helium.
>>
>>52348502
for container 2:

$ python test2.py
item 1 : 80 pcs
item 2 : 79 pcs
item 3 : 79 pcs
something remains, nigger!!! 0.0800000000000054
>>
>>52348502
Time to drop out.
>>
>>52347132
fantastic, thank you!
>>
>>52346599
rallando
>>
>>52348527
not CS, by the way..
>>
File: 1452150101666.jpg (180 KB, 600x600) Image search: [Google]
1452150101666.jpg
180 KB, 600x600
W-why aren't I the only /dpt/ image anymore, /dpt/?

D-don't you love me anymore?
>>
>>52348549
Would you a robutt, /dpt/?
>>
>>52348549
"no"
>>
File: 1450255630905 (1).jpg (46 KB, 440x398) Image search: [Google]
1450255630905 (1).jpg
46 KB, 440x398
yea roll me
>>
>>52348549
>>>/a/
>>
File: 1452022377677.jpg (256 KB, 757x534) Image search: [Google]
1452022377677.jpg
256 KB, 757x534
I-I still love you, /dpt/.
>>
>>52348590
why download the same picture??
>>
>>52348398
Just send all keys from 0-255 and see what you get
>>
pls be easy
>>
el rolando mexicano
>>
challenge 87:

from math import factorial as fact

lines = 50

for k in range(0, lines):
for n in range(0, k+1):
print fact(k)/(fact(n)*fact(k-n)),
print
>>
File: gdfg.png (87 KB, 845x1431) Image search: [Google]
gdfg.png
87 KB, 845x1431
>>52347438
Laugh at my shit code for the 4chan image downloading extension, /dpt/.
>>
Anyone here use Neo4j/Cypher? I could use some help optimising a query.
>>
>>52348788
not so bad
>>
Any ideas how I'd go about recording a usable virtualkeycode from this event?

        private void btnOutputSelect_KeyDown(object sender, KeyEventArgs e)
{
if(outputIsSelected == true)
{
btnOutputSelect.Content = "Output Key: " + e.Key.ToString();
outputIsSelected = false;
}
}
>>
File: Georgi.jpg (46 KB, 389x486) Image search: [Google]
Georgi.jpg
46 KB, 389x486
>>52346599
roll
>>
File: BFcode.png (37 KB, 525x1189) Image search: [Google]
BFcode.png
37 KB, 525x1189
r8 brainfuck code
Brainfuck.py <"file" or "cmd"> <filename or BF code> <"cc" or "ci" or "ic" or "ii">


cc - char input, char output
ci - char input, int output
ic - int input, char output
ii - int input, int output


example
Brainfuck.py file "example.txt" cc
Brainfuck.py cmd ",>,<[->+<]>[-[->+<[<]]>[>]<<]>." ii
>>
Just a reminder, if your language of choice is not on this list- you should kill yourself.
>Python
>Java
>Haskell
>Ruby
>Javascript
>>
>>52349213
>Javascript
oh dear
>>
File: 1452442482702.png (286 KB, 689x455) Image search: [Google]
1452442482702.png
286 KB, 689x455
>>52349213
>Javascript
That's not fair, anon. It's not like I can use C++ for client-side scripting.
>>
>>52349213
>javascript
oy vey, kek.
>>
>>52349246
>>52349276
>>52349295

Javascript is by far one of the most powerful languages out there today, it is absolutely revolutionary and people underestimate how useful it is.
>>
>>52349301
>revolutionary
javascript, not.
golang is.
>>
File: 1451751832808.png (17 KB, 418x359) Image search: [Google]
1451751832808.png
17 KB, 418x359
>>52349309
>golang
>worthy of mention
>>
File: 1452442001809.png (281 KB, 868x510) Image search: [Google]
1452442001809.png
281 KB, 868x510
>>52349213
>>52349276
My mistake, anon. I thought you were bashing JavaScript.
>>
Javascript still is the god-tier programming language

it was used to make minecraft anyways
>>
>>52349301
if only it were type safe
>>
File: 1452446300011.png (229 KB, 628x708) Image search: [Google]
1452446300011.png
229 KB, 628x708
>tfw you encounter a problem you don't know how to solve
>>
>>52349366
>tfw I excavate your mums pussy
>>
File: Java.png (311 KB, 1016x843) Image search: [Google]
Java.png
311 KB, 1016x843
>>52349366
Learn, god damn, JAVASCRIPT.

It's the best way to go, anon ;x

Javascript
avascript
>>
>>52349358
This. I would love to have JS with native C/C++ type hinting and import-time type errors.
>>
>>52349366
>tfw you encounter a problem that's bigger than a script
b-but I love scripts
>>
File: 1452441537054.png (213 KB, 634x575) Image search: [Google]
1452441537054.png
213 KB, 634x575
I think the people who hate JavaScript have never tried using it if I'm being honest.
>>
File: 1451754656606.png (17 KB, 418x359) Image search: [Google]
1451754656606.png
17 KB, 418x359
>recursive functions
>>
File: 1452420834970.png (536 KB, 600x720) Image search: [Google]
1452420834970.png
536 KB, 600x720
>>52349454
Stop being a dumb frogposter, anon. It's 2016.
>>
>>52349434
They are mostly people who keep around the ES5 or even ES3 stigma. ES6 is a good enough language.
>>
>>52349434
I tried using it and I dont like its lack of type saftey.
>>
What is /dpt/'s opinion on Deep Learning/Machine Learning Systems? It seems over the past 5 or so years there have been massive advances in it.

To my surprise, Google recently open sourced TensorFlow which is what Google uses for Google Photos, allowing users to search for any attribute they could think of which appears in an image, such as cat, cloud, sky, pool, hair color, eye color, etc. It's now become pretty popular on GitHub.

Anyone got any experience working with things like this in projects?
>>
>>52349522
stonerbait pythonshit
>>
>>52349454
Recursion > iteration in almost all cases

>mfw someone says they prefer iteration with an explicit stack over recursion near me
>mfw someone uses a language without tail call optimization near me
>>
>>52349547
only 2 memes in one post, you could do better
>>
File: Untitled-1.jpg (79 KB, 721x308) Image search: [Google]
Untitled-1.jpg
79 KB, 721x308
void printBridge(unsigned int draw[], unsigned int *stepCount, unsigned int n, char Op[4][8], unsigned int select, unsigned int activeGoat) {
unsigned int j;
if (select == 1) printf("[%d] Op: %s\n", *stepCount, Op[select]);
else if (draw[activeGoat] <= n) printf("[%d] Op: %s a%d\n", *stepCount, Op[select], draw[activeGoat]);
else printf("[%d] Op: %s b%d\n", *stepCount, Op[select], draw[activeGoat] - n);
for (j = 1; j <= 2 * n + 1; j++) {
if (draw[j] == 0) printf("%s ", Op[0]);
else if (draw[j] <= n) printf("a%d ", draw[j]);
else printf("b%d ", draw[j] - n);
}
printf("\n");
*stepCount = *stepCount + 1;
}

void goatBridge(unsigned int n) {
unsigned int i, stepCount = 0, draw[100000], currentGoat, space = n + 1;
char Op[][8] = {{'_'},{"none"},{"advance"},{"jump"}};
draw[space] = 0;
draw[2 * n + 2] = 1;
for (i = 1; i <= n; i++) {
draw[i] = n + 1 - i;
draw[n + 1 + i] = n + i;
}
printBridge(draw, &stepCount, n, Op, 1, 0);
while (1) {
for (i = n; i > 0; i--)
if (draw[i] <= n) {
currentGoat = i;
break;
}
if (i == 0) break;
if (draw[currentGoat + 1] != space)
while (draw[space - 1] > n) {
swap(&draw[space], &draw[space - 1]);
space--;
printBridge(draw, &stepCount, n, Op, 2, space + 1);
}
while (1) {
swap(&draw[currentGoat], &draw[space]);
currentGoat++;
space--;
printBridge(draw, &stepCount, n, Op, 2, currentGoat);
if (draw[currentGoat + 1] <= n && draw[currentGoat + 1] != 0) break;
else {
swap(&draw[space], &draw[currentGoat + 1]);
space += 2;
printBridge(draw, &stepCount, n, Op, 3, currentGoat - 1);
}
}
}
}

int main() {
unsigned int n;
FILE *fin = fopen("init.in", "r");
fscanf(fin, "%d", &n);
goatBridge(n);
exit(EXIT_SUCCESS);
}


I asked about this problem yesterday, some anon gave me a pretty good indication and I managed to solve it. It's probably not even close to what it should be and takes a shit ton of time to execute, but at least I tried.
>>
>>52349522
Kids think those fields sound cool, next day "mom look, I made a neural network in python!". It's kind of annoying when some shit in your field just gets bombarded with popularity from "hackers" that don't really know shit other than coding in python and learning basic programming in meme languages, thinking they're on the bleeding edge.
>>
>>52349108
Why are you guys so obsessed with brainfuck?

It's just a joke language.
>>
>>52349671
>so obsessed
what are you on m8? and we know it's a joke language
>>
>>52349613
I can't read that clusterfuck

did you use a technique similiar to bubble sort?
>>
Am I late?
Rolling
>>
>>52349671
>you guys
Hello reddit.
>>
>>52349667
Noob programmer here, why does almost every neural network library use Python?
>>
>>52349720
python is popular with researchers
>>
>>52349697
It keeps consistently popping up in /dpt/

>>52349716
Sorry I meant you fags.

Happy now?
>>
>>52349700
Pretty sure he just outputs the result of those opcodes

>>52349739
>It keeps consistently popping up in /dpt/
Over the past day or 2
>>
File: ss+(2016-01-10+at+01.46.11).png (4 KB, 407x26) Image search: [Google]
ss+(2016-01-10+at+01.46.11).png
4 KB, 407x26
nice
>>
>>52349716
Hello reddit.
>>
>>52349752
>Over
I mean only
>>
>>52349753
you probably made your money back, anon!
>>
File: 21858388367.jpg (125 KB, 500x338) Image search: [Google]
21858388367.jpg
125 KB, 500x338
>>52349366
> tfw you encounter a problem you know how to solve but you can't due to the language limitations
>>
>>52349739
Please go back to reddit.

>>52349434
I think the people who think JavaScript is good don't have enough programming experience to be honest. It's pretty much a clusterfuck of conveniences that doesn't perform very well.
>>
>>52349700
Kinda, search for the closest opposing one, move the space next to it if needed and then just move it to the other end. Can't think of anything else to do. I imagine there's some algorithm that does it in three lines or something.
>>
File: test.png (2 KB, 400x400) Image search: [Google]
test.png
2 KB, 400x400
>>52349779
your png is now optimized
>>
>>52349805
What do you mean by optimized?
>>
>>52349752
the opcode by themselves can't solve the problem without an algorithm to combine them so I don't know what you're trying to say there. the problem is how the opcodes are used in order to get the goats passed the bridge.

I was asking if he used an approach similar to bsort
>>
>>52349790
Please go back to reddit.
>>
>>52349779
Is anon coding something that converts his posts into an image?

That's a neat idea.
>>
>>52349829
>im trolling 4chan so hard xD

>>52349817
3 KB to 2 KB I'm guessing
>>
>>52349872
>im trolling 4chan so hard xD
>>
>>52346966
teaching an outdated communication standard

k
>>
>>52346599
rollerino papparazo
>>
>>52349213
You added an extra 'not' here.
>>
>>52349407
>have problem
>learn javascript
>now you have 2 problems
>>
stop rolling niggers

GO HERE

https://better-dpt-roll.github.io/
https://better-dpt-roll.github.io/
https://better-dpt-roll.github.io/
https://better-dpt-roll.github.io/
https://better-dpt-roll.github.io/
https://better-dpt-roll.github.io/
>>
test

import sys
#word=sys.argv[1]
word = "MEME MACHINE"

leng=len(word)

print "\n "+word[0]+" "*(leng-2)+word[::-1]

for i in range(leng-2):
print " "+word[i+1]+" "*(leng-2)+word[leng-i-2]

print " "+word[-1:0:-1]+word

for i in range(leng-2):
print " "*(leng)+word[i+1]+" "*(leng-2)+word[leng-i-2]

print " "+word+" "*(leng-2)+word[0]
>>
Where does this "you need to know advanced math to understand SICP" meme come from?

It's high school math at most.
>>
>>52349789
>he's programming language isn't turing complete
>>
>>52349522
The tensorflow they opensourced is actually just a small part of it. Internally, they use several still closed-source tools such as a custom cuda compiler. As a result, the opensource tensorflow is significantly slower than previous options (theano, caffe, torch) and not viable for actual use yet. It also doesn't have multl-gpu support yet which the other options do.
>>
File: 1432247209066.png (39 KB, 410x313) Image search: [Google]
1432247209066.png
39 KB, 410x313
>>52350101
>his is
>>
File: meme code executor.jpg (59 KB, 699x695) Image search: [Google]
meme code executor.jpg
59 KB, 699x695
>>52350083
wahey, still works
>>
>>52347068
>8char indents on /dpt/
>why.png
>>
File: 1452441914124.png (301 KB, 604x660) Image search: [Google]
1452441914124.png
301 KB, 604x660
REEEEEEEEEEEEEE

I'M REEEEEEPEATING MYSELF AGAIN.

    if(thread.files.jpg) {
document.querySelector("#filecount").insertAdjacentHTML("beforebegin", "[<label for='jpg'>jpg</label>]<input type='checkbox' id='jpg'/>")
}
if(thread.files.png) {
document.querySelector("#filecount").insertAdjacentHTML("beforebegin", "[<label for='png'>png</label>]<input type='checkbox' id='png'/>")
}
if(thread.files.gif) {
document.querySelector("#filecount").insertAdjacentHTML("beforebegin", "[<label for='gif'>gif</label>]<input type='checkbox' id='gif'/>")
}
if(thread.files.webm) {
document.querySelector("#filecount").insertAdjacentHTML("beforebegin", "[<label for='webm'>webm</label>]<input type='checkbox' id='webm'/>")
}
>>
I ended up running out of time on this problem, but I still really want to know what the solution was supposed to be, if anybody can help that would be great.

If anything isn't explained well enough, or if any of my code is hard to follow, just ask.

Pastebin of the original problem: http://pastebin.com/HhG4617W
(TL;DR: You're lost in a subway system, and there are no maps to show you where you are. All you have is a list of tracks and where they take you. Is it possible for you to take a set series of tracks from any station and always end up at the same place?)

examples of trees: http://pastebin.com/VfAQYdEF

my solution: http://pastebin.com/3sbp8k29

The basic idea is to put a rabbit at each station initially, and have them all take the same track, and work my way down the tree using a breadth first search. The problem I run into is I don't have enough memory to store the queue once my program gets to the about the 25th level of the tree

The only way I can think of to get around this is to either prune the tree more, or to find some other method which generates smaller trees.
>>
>>52350113
The fuck am I looking at?
>>
>>52350171
cancer
>>
>>52349720
The requirements for ML are:
-very quick development cycle
(because most of the time you're changing a few hyperparameters and trying the same model again)
-speed
(otherwise you're waiting a month to process data before you can choose new hyperparameters)
-ease of modification
(otherwise you spend a day adapting a model slightly despite their similarities rather than a few minutes).

Python is great at 1 and 2 and it has C syntax so everyone's familiar with it. For 2, the fact it's dynamic/typeless means you can get something (very buggy) running very quickly. In practice, it's actually an inconvenience but that's not how it was initially interpreted. Now everyone's kinda stuck with it, and so nobody even looks once at a library that doesn't have extensive unit testing and over 90% coverage.
Python sucks balls at 2 but it doesn't matter because CPUs are too shit at matrix operations (which is what ANNs are bottlenecked by), so everyone offloads the work to the GPU. Thus, the python code is actually a very high-level set of bindings to C and CUDA code, and the speed of the host language only matters slightly because it takes much longer to fetch the data from the disk and to perform operations on the data than it takes to prepare the data to be sent to the GPU.
>>
>>52350139
m8 this is easy to solve.
>>
>>52350171
Agda, looks like something to do with homotopy type theory (based on "Hom" and "fibMap")
>>
>>52350171
shitpost: the language
>>
>>52350069
>js
Nice try, NSA.
>>
>>52350133
It's contained within a bunch of other stuff.

Fuck if I'm dicking about with indents. Copypaste directly and post.
>>
>>52350148
jesus christ m8, that problem
>>
>>52350139
try "or"
>>
>>52350139
why do you not use a wildcard
>>
File: 1452446155799.png (221 KB, 888x900) Image search: [Google]
1452446155799.png
221 KB, 888x900
>>52350192
Yeah, I know. I just hate using loops.

var type = ["jpg", "png", "gif", "webm"];

type.forEach(function(elem, index, array) {
if(thread.files[elem]) {
document.querySelector("#filecount").insertAdjacentHTML("beforebegin", "[<label for='" + elem + "'>" + elem + "</label>]<input type='checkbox' id='" + elem + "'/>")
}
});
>>
my minimax isn't terminating for some stupid reason

on the plus side it looks like it'll be able to search more than 2 million nodes within a second which is a lot better than I was expecting after how badly everyone has been shitting on pythons performance
>>
>>52350069
>pokeapi.co
jesus christ, their autism reaches new bounds
>>
>>52350297
It means you'd be getting 100m nodes a second with the same algorithm in e.g. java or C#.
>>
>>52350208
fucking sucks, I'm mostly hoping someone who has already solved it can explain their solution to me.

Obviously generating the tree is the wrong way to go (unless there's some god-like pruning strategy that I'm unaware of), but I couldn't find another idea.

There's probably some way to recognize if there is or isn't a solution more or less immediately out there.
>>
File: ss+(2016-01-10+at+02.19.48).png (1 KB, 373x20) Image search: [Google]
ss+(2016-01-10+at+02.19.48).png
1 KB, 373x20
>>52349781
best I got
>>
>>52346599
web development is also programming
>>
Any Neo4j users here?
>>
>>52350353
>this meme again
>>
>>52350324
Why stop at Java and C# you fucking cuck?
>>
File: 1451779320598.png (20 KB, 418x359) Image search: [Google]
1451779320598.png
20 KB, 418x359
>>52350353
>>
>>52350353
don't even start with this shit
>>
>>52350148
double-ended or MAB.
>>
>>52350353
ebin
>>
>>52350373
Because it wouldn't be fair to compare python to good languages like ocaml.
>>
>>52350386
>>52350384
>>52350378
>>52350371
Never fucking reply to me again unless you're contributing to the thread.
>>
File: 1451541273544.gif (417 KB, 450x253) Image search: [Google]
1451541273544.gif
417 KB, 450x253
>mfw the Counting Change section of SICP
>>
>>52346707
almost in the same exact position as you. I had a death wish for java and then I figured out how easy it is to use.
>>
>>52347354
https://en.wikipedia.org/wiki/Inverse_hyperbolic_function#Inverse_hyperbolic_sine
Do some math
>>
>>52350414
this guy again
>>
>>52350551
What the fuck did he just say?
>>
>>52350385
I'm already using a deque and I can't really see how MAB would be usefully applied to this problem, considering there's no real way to calculate loss or regret in this problem.

in either case neither of these would have affected memory usage, which was what really killed me.
>>
>>52350570
Never fucking reply to me again unless you're contributing to the thread.
>>
>>52350414
ok, kid.
>>
>>52350575
A dequeue is not a double-ended search. The regret is -1 when you reach the start position, 0 otherwise.
>>
>>52350587
Never fucking reply to me again unless you're contributing to this thread.
>>
File: fRANCE.png (58 KB, 292x165) Image search: [Google]
fRANCE.png
58 KB, 292x165
Any french here? or anyone who solved problems on http://www.france-ioi.org/ ? or anyone who can read french and want help me solve this problem?

Problem: http://www.france-ioi.org/algo/task.php?idChapter=656&idTask=0&sTab=task&iOrder=4

I need to solve the 5 problems to pass to the next level. i solved 4, the 5th gives the correct output on 18/20 of tests, i still fail two.

if anyone wants to help i can translate the problem

else, how can i cheat of the test? It already told me the correct output on test #6 is 4

thanks for any help given
>>
>>52346599
rolling
>>
>>52350703
>frenchman giving up

colour me surprised
>>
>>52350730
guilty kek
>>
File: Screenshot_20.png (1 KB, 92x40) Image search: [Google]
Screenshot_20.png
1 KB, 92x40
>>52350730
after the 10th attempt

also im not french
>>
>>52350730
It's a site for kids. Not for 18+.
>>
>>52350730
>murrican't even try but sure can criticize
typical.
>>
>>52350627
I thought you meant a double ended queue - https://en.wikipedia.org/wiki/Double-ended_priority_queue
Which is the only thing I've learned that could be called "double ended" and is also the only thing that shows up when I google "double ended search"

Assuming a double ended search is exactly what it sounds like, though, I would need to know the end condition before I started searching, which is (as far as I'm aware) impossible. You're not made aware that the station that the meeting path will terminate at is any specific station before you start searching, it's only after the search is over that you could know where the meeting path terminates.

Basically "how can I preform a double ended search when I only know of one end?"

>The regret is -1 when you reach the start position, 0 otherwise.
So the regret is 0 unless I've found the solution?

I'm not sure how this would help matters
>>
>>52349805
How do you optimize a png? I'm curious.
>>
>>52350787
lrn2cfrm noob.
>>
>>52349817
>>52350799
same quality but smaller in file size
?
>>
>>52350848
Yes. The same information must be encoded. PNG is not JPG. It's lossless.
>>
>>52347006
/g/ has like one janitor and the one janitor isn't very strict

it would be nice if they enforced the bump limit/posting duplicate threads rule like they used to. right now they do an interpretation where the thread posted before the bump limit is considered to be a legitimate continuation (as opposed to a duplicate) while any thread posted after the premature thread is considered a duplicate to be removed.
>>
File: CONDUCTOR.gif (301 KB, 136x240) Image search: [Google]
CONDUCTOR.gif
301 KB, 136x240
>>52350866
>MOOOOOOOM
>>
>>52350866
That's how things work site-wide, it's just that /dpt/ is the only general autistic enough to constantly create early threads

Like, /brit/ has an unwritten rule that a new one can't be created until page 7, but if one is created before that and the janitor doesn't get it before the old one is past that point, they let it be
>>
File: free.jpg (42 KB, 959x639) Image search: [Google]
free.jpg
42 KB, 959x639
>>52350866
>it's not fair i don't get to post my images because they have initiative and sense! at 309 posts? delete their one pls mods!
>>
File: lojbo.png (43 KB, 1214x764) Image search: [Google]
lojbo.png
43 KB, 1214x764
Does learning Lojban make you a better programmer /g/?
>>
When MOOT was in the lead the were no transvestite /dpt/ threads on /g/.
>>
>>52350866
a pretty good thread about how the source code of linux and freebsd got leaked just got deleted
fuck the janitors
>>
>>52350958
Who do you think is posting all the tranny threads?
>>
>>52350913
>>52350935
have fun getting threads at 280-290 with shitty images and texts

>>52350920
/brit/?

>>52350958
this
>>
>>52347390
woah haxxxxxx
>>
>>52350977
moot is not into dickgirls
he's more into cuckoldry
>>
>>52350866
>>52350920
Point is, there's no reason to delete an early thread once the old one has started autosaging

After that point, any other thread, even created after the bump limit, just looks like a duplicate thread, and posters always flock to the first one anyways
>>
>>52350993
>shitty images and texts

>t. totally not butthurt about being beaten by trannies
>>
>>52350948
thats like asking does killing yourself make you better at suicide
>>
>>52350958
Who?
>>
>>52350999
>Point is, there's no reason to delete an early thread once the old one has started autosaging
yes there is, it discourages shitposters from posting early threads in the future. it's how they used to do it before we got these fucking trap threads
>>
>>52350958
never he posted on /g/, never.
>>
>>52350998
Yeah, being cucked BY dickgirls
>>
>>52351013
this is not some sort of game you delusional mutilated freak

and even if it were you're breaking the rules by posting threads early

instead of posting after the bump limit with some threads being traps and some being non-traps, you get most threads prematurely with some still being traps and some still being non-traps

fucking cancer fucking kill yourself you piece of biological trash
>>
>>52351029
>posting an early thread is now shitposting
get the fuck over it it doesn't make a fucking difference when people post a new thread 30 or 40 posts early

when people do it at 150, it gets deleted by a janny like it fucking should be
>>
>>52351074
I'm not the one posting traps, I'm the one telling you to get over it.
>it's not fair I can't compete so I should bring everyone else down to my level
You sound like a liberal
>>
NEW THREAD:

>>52351089
>>52351089
>>52351089
>>
>>52351093
fuck off
Thread replies: 255
Thread images: 46

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.