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

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 327
Thread images: 32

File: 18211.png (98KB, 400x300px) Image search: [Google]
18211.png
98KB, 400x300px
CRAWLING IN MY SKIN EDITION

PREVIOUS THREAD AT >>51562843

WHAT ARE YOU WORKING ON /G/
>>
File: 1eBQhRx.png (5KB, 327x98px) Image search: [Google]
1eBQhRx.png
5KB, 327x98px
>2015
>not using nvforth
>>
THESE WOUNDS THEY WILL NOT HEAL
>>
>comic sans
>picture speaks to itself
>>
>>51568547
do i need to memify this?
:~$ ./lolisp meme.cj
([][])([][])([]([[[][]]]()))([]([[[][]]]()))([]((()())))([](*()()))([]([[[][]][
]](((<)(<)))))([]([[]]((()()))))
Meme: 111
Total: 749
Total meme percent: 118.55%
random sample.
>>
>>51568507
Doing my programming assigning which is basically practice with bst and recursion.

That feeling when you actually understand a concept is awesome.
>>
File: Image 2.png (38KB, 1125x707px) Image search: [Google]
Image 2.png
38KB, 1125x707px
Trying to figure out why in the fuck my book says the answer should be 406 ft/s when everything I've tried spits out 65 ft/s...
>>
>>51568555
no u
>>
> port2 = port1 + 1
>TypeError: Can't convert 'int' object to str implicitly
>python
It's like 1 am, Can someone explain this?
How do I convert it explicitly?
It's simple addition, shit. Man.
>>
>>51568730
port2 = port1 + str(1)
>>
>>51568730
int(port1) + 1
>>
File: 1286228503366.png (359KB, 698x563px) Image search: [Google]
1286228503366.png
359KB, 698x563px
>>51568730
>python
>TypeError
>>
>>51568741
Oh disregard this, I can't read... unless you want integers of course...
>>
Is there any where with good DP exercises? I desperately need more practice in Dynamic Programming.
>>
>>51568572
im gonna post it on github in a little bit so you can memify the code to the interpreter (lolisp). ill post the code to the entire standard library when im done with it so that you can memify that too~
>>
>>51568773
thank you!
I look forward to it.
>>
Does programming ever get stressful for you /dpt/? What do you do to relax?
>>
>>51568730

get familiar with str() and int()
>>
>>51568507
>relying on print statements instead of unit tests
>>
>>51568943
please don't be sarcastic. it's friday, let's all be friendly.
let's hug? im not that fag op, i mean you and i.
>>
>>51568856
Entertainment. Videogames, movies, series, books, anime etc.

Currently I'm wondering if I should start reading Spice and Wolf LN's from 6 or if I should start reading the Assasins Apprentice by Robin Hobb.
>>
File: Untitled.png (11KB, 478x316px) Image search: [Google]
Untitled.png
11KB, 478x316px
Created a grade book where the teacher can enter a name of a student, submit 4 test scores, then the program will get the average and the grade depending on those averages.
>>
>>51568943
Print statements are for debugging, unit tests are for avoiding bugs. Both have their uses.
>>
>>51568943
>relying on unit tests
>not being able to think for yourself
>>
>>51569074
>unit tests are for avoiding bugs
kek
>>
Creating the repo for my forth now. What should I call it (dubs decides)?
>>51568781
stdlib so far:
: not if -1 else 0 then ;
: or if else drop -1 then ;
: and if drop 0 else then ;
: xor not if not else then ;
: <> xor ;
: sep '| ;
: sep? sep = ;
: print dup . ;
: print* dup sep? if . print* else drop then ;
: drop* sep? if drop else drop drop* then ;
>>
File: suicide.png (174KB, 1366x768px) Image search: [Google]
suicide.png
174KB, 1366x768px
>>51568894
>>51568746
>>51568741
>>51568737
>>51568730
What now?
>>
File: LinkinParkRulez.png (325KB, 1280x694px) Image search: [Google]
LinkinParkRulez.png
325KB, 1280x694px
>>51568507
Teaching myself C++, I'm having a lot of fun with it so far.
>>
>>51569113
Says every bug magnet ever. Unless you're programming in Haskell or something where you provide a formal proof of your program then you should use unit tests.

>>51569114
What was incorrect with what I said?
>>
File: python.png (2KB, 547x303px) Image search: [Google]
python.png
2KB, 547x303px
>>51569136
>>
>>51569131
ans forth or/and/xor are bitwise, not logical.
>>
>>51569149
>this is what javascript users actually believe
>>
>>51569195
I don't program in javascript, in fact I hate everything that has dynamic typing. I'm not a memory management fag, so I prefer shit like C#
>>
>>51569194
hm ill add those too later on.
bor
band
bxor

i guess? or i can just switch the existing ones to have a "l" prefix. although i'm not really trying to follow standards 100%
>>
File: stangor-fig09_007.jpg (170KB, 1648x691px) Image search: [Google]
stangor-fig09_007.jpg
170KB, 1648x691px
friendly reminder that the vast majority of the population is stupid as hell and you are one of those people
>>
>>51569142
can I have ur wallppr? :D
>>
I've never really given python a proper chance, but it's kind of great for doing quick work. Trying to program a concept just to learn it or trying to do exercises in algorithm without having to think too much about the language limitations.

string = "itwasthebestoftimes"

validwords = ["i","it", "was","the","best","of","times","time","as"]

storedWords = []

def dp(st):

for i in range(0, len(string)+1):
for j in range(i, len(string)+1):
print string[i:j]
if string[i:j] in validwords:

storedWords.append(string[i:j])


dp(string)

print(storedWords)
>>
I'm trying to learn Qt. First I tried out a Python wrapper for it and it was a total waste of time as there is absolutely no doc and good luck figuring out what maps to what. Then I reluctantly tried out C++ and it's even worse. What IDE should I be using? VS doesn't even work with the regular version of Qt, had to get a different version specifically for microshit and I can't even generate a new project without errors out the ass. I can't be assed with manually compiling and linking shit, I want something that just werks so I can start learning Qt. Anyone have any tips?
>>
Would writting something to edit metadata on an mp3 file be difficult? I basically want to run through my library, parse the year out on the directory names and use tag the mp3 files inside with that year.

I don't know how to deal with directories or mp3 metadata though, so some utilities are helpful on where should I start to learn what I need to learn. I'd be using C preferably, or Python.
>>
>>51569297
oh and I'm on linux
>>
>>51569293
use qtcreator
>>
>>51569136
Regex findall returns a list of matched strings, or a list of tuples if your regex contains multiple groups. You can't convert an entire list to an integer, but you can iterate over the matches.

In this case your list is ['56630'], so you have to print
int(yourmom[0])
>>
>>51569343

Tried that with the msvc version and it couldn't detect the compiler. Might go back and get a different version of Qt later but I'm pretty salty right now.
>>
Is it stealing if I go to the app store, see the description on what the application does, and do those features with c++ coding? Beginning coder, but I want to make applications that cost money at the application store so that I don't have to buy it.
>>
>>51569297
That's a good candidate for python. Look up eyeD3. It's a library for python that allows you to work with mp3 files very easily and intuitively.
"python mp3" is a good search on Google as well (try out any stackoverflow result that may pop up)
Working with files and directories in python is not painful at all. It could take you less than 30 minutes to get all you need to know about all that.
Lastly I'd suggest using Pycharm cause it makes it easier to 'install' libraries, plus it's a really good IDE (and it's free)
Summing up: install pycharm, use it to get eyeD3, start coding. Have fun
>>
>>51569393
thank you
>>
>>51569388
No, it's not. It'd be if you then were to sell it
>>
>>51569365
That outputs [
?
I'm sorry, anons.
I have no idea what I'm doing.
>>
File: vomit.jpg (90KB, 650x650px) Image search: [Google]
vomit.jpg
90KB, 650x650px
>>51569142
>Crawling.c
>C++
>>
>>51569279
https://www.google.com/searchbyimage?image_url=https%3A%2F%2Fi.4cdn.org%2Fg%2F1448691686234.png
>>
>>51569142
Mate don't listen to the other people. The only wrong you're doing is not using vim instead of gedit or whatever text editor that is.
>>
>>51569437
pattern = "\d{4,6}"
meme = re.compile(pattern)
yourmom = meme.findall(con)
print(yourmom[0])
>>
>>51569387
What do you have installed? I have vs2013 and I downloaded qt5.5.1
>>
>>51569498
TypeError: expected string or buffer

Would it be easier if I posted the whole thing?
>>
>>51569551
yes
>>
>>51569558
Prepare yourself, anon.
https://ghostbin.com/paste/qxb2x
>>
>>51569521

vs2015 community and qt5.5.1 msvc
>>
>>51569611
seems like there isn't an official build for 2015 (expected by 5.6.0), so that's probably why it had issues detecting
>>
I posted this in ded thread edition:
so perl is neat, but i'm now learning that nobody uses it anymore.

what are the "hip" alternatives, and where do they shine. python and ruby come to mind, but i know little about them.

Basically, what scripting language should i really focus on learning?
>>
>>51569798
Learn python
>>
>>51569802
follow up question:

best books/resources for an "intermediate" programmer on python?
preferably terse
>>
>>51569551
Okay, I think I found an easier way to do it.

You're trying to get the port code, right?

The module that you're using returns a list when you call the connections(type='udp4'), returns a list of pconn objects with the following fields:
fd
family
type
laddr
raddr
status


So you can do something like:
con = d.connections(kind='udp4')
for connection in con:
print connection.laddr[1]


And it will print what you want without having to do regex bullshit.
>>
>>51569798
python is the only answer to your question
>>
Any little challenges people have for intermediate programmers?
>>
>>51569865
leetcode.com
>>
How do you usually name your variables, /g/?

I tend to use a mix of both camelCase and underscores probably because I have autism.

myNumber // good readability, look fine
oldFag // esthetically terrible!
senileFag // e and F look better
old_fag // look okay
old_fag_holy_shit_what_are_you_doing // these underscores are annoying to type
butItCouldBeFarWorse // readability is horrible, doesn't look good
>>
File: tetris.webm (552KB, 640x480px) Image search: [Google]
tetris.webm
552KB, 640x480px
Ask your beloved programming literate anything.
>>
asp.net MVC or jsp or my newest web app

not interested in any other unemployable meme platforms
>>
I detest programming, at every fucking step, I find bugs and retarded problems in standard libs, programs I need, and so on. but I think it's the best alternative I have for my life

seriously, should I just resist, or should I off myself?
>>
>>51569876
>esthetically
>autism
but not attention to detail.
>>
>>51569834
Thanks, man.
Got it working.
>>
in terms of performances, is it better to generate 2 different bitmapfonts or use the same bitmapfont for separate glyphlayouts
>>
>WHAT ARE YOU WORKING ON /G/

going to make turn based asteroids on a text grid
>>
>>51569921
>it's the best alternative I have for my life

What does this even mean?

If you hate programming then don't do it. I'd rather make half as much money than do something I despise every day. That shit will kill your soul anon
>>
>>51569922
I knew I had spelt something wrong!
>>
File: 6XWggeh.jpg (266KB, 600x699px) Image search: [Google]
6XWggeh.jpg
266KB, 600x699px
>>51569879
Lisp or Sceme?

Also, who said you're beloved.
>>
>>51570077
I am not your beloved programming literate.
Neither. Use Racket instead. More consistent than Lisp and not as useless as Scheme.
>>
>>51570077
chicken scheme
>>
>>51569990
well, it's one of the few technical things I know how to do, and it can even be used to make money by myself... that's way better than working with/for other people
but I'm starting to hate computers, and programming has always been the worst part of this all
>>
>>51570156
>that's way better than working with/for other people
That's most programming task outside of tiny companies. And even in tiny companies you have to work together with other people.
>>
>>51569977

I laughed audibly
>>
File: 1380571098299.jpg (152KB, 1000x1333px) Image search: [Google]
1380571098299.jpg
152KB, 1000x1333px
A friend of mine just gave me a shitload of iBeacons however I can only program in ruby and python. Is there a way for me to use these things with my phone without having to progam in Java?
>>
C or C++ /g/?

std::vectors are pretty nice and I dont want to reimplement them or other C++ features
>>
File: 2015-11-28-033413_889x85_scrot.png (4KB, 889x85px) Image search: [Google]
2015-11-28-033413_889x85_scrot.png
4KB, 889x85px
goodnight friends
>>
it's time to renew my subscriptions, /g/.

what are the best linux / programming / IT magazines?
>>
>>51570310
popular science
>>
Now that both of these are finished,
What do you people thing the best way to communicate between them would be?
I don't want it to screenshot and timestamp EVERY time it gets 20 packets,
What should I do?
Right now it gets the IP from my clipboard.
>>
File: derp.png (267KB, 1366x768px) Image search: [Google]
derp.png
267KB, 1366x768px
>>51570366
>>
>>51570310
r/programming
already 662,319 readers
>>
>>51569876
I generally follow the convention of the language that I'm programming in. camelCase in Haskell for instance. However I mostly write C and Python, which means I use lowercase and snake case. For instance, makeusr() is fine but debugobjectinitonstack is in need of some underscores.
>>
File: 0483 - 3PfY6vY.jpg (82KB, 374x363px) Image search: [Google]
0483 - 3PfY6vY.jpg
82KB, 374x363px
>>51570379
>not just music in the main music folder
>>
>>51570379
God this screenshot is so fucking disgusting
>>
File: 1431812691882.jpg (224KB, 800x1202px) Image search: [Google]
1431812691882.jpg
224KB, 800x1202px
can you recommend me a good set of exercises to do in ia32 assembly?
>>
>>51568767
in a book about it? I think CLRS cover a bit of it in their book
>>
>>51570500
>>51570521
I recently moved everything and put it there.
That's why I've been blocking it out.
I don't care any more, anon.
my HDD failed.
>>
>>51570592
Book or website, anything is cool. Also could I have the full name of CLRS?
>>
File: attendance.jpg (50KB, 749x673px) Image search: [Google]
attendance.jpg
50KB, 749x673px
What's the most employable lang that isnt
>java
>c#
>c
>c++
>javascript
>php
>>
>>51570644
Go
>>
>>51570644
probably python or ruby.
>>
>>51570644
You won'¨t get proper answers asking such a question, why are you discarding these languages so quickly anyway?

Ruby or Python, perhaps?
>>
>>51570644
Around here? Clojure.
>>
>>51570613
https://mitpress.mit.edu/books/introduction-algorithms
it's easily available on the usual places
>>
>>51570695
Thanks buddy, I appreciate it.
>>
>>51570691
Where is "here"?
>>
>>51570714
here on the 4chan labor market.
>>
>>51570714
Tampere, Finland.
>>
I've decided that my first project will be a creative crawler. You start with a search term, and then branch out into smaller and smaller subtopics (ex. "Mexico" will lead to "Agriculture, History, Current Events, Topography" etc.) Thus you might find bits of information too specific to have been found by one or two generic search terms.

Nestl. A portal for the mildly interesting.
>>
>only one semester away from graduating
>glance at my qualifications
>look back at prerequisites for entry-level jerbs
>no vodka in the freezer
>fuck
...and that's why I'm coding neural nets with Rust at four o'clock in the morning.
>>
File: 1443647604474s.jpg (6KB, 250x213px) Image search: [Google]
1443647604474s.jpg
6KB, 250x213px
>>51570762
>keeping vodka in the freezer
Shit like this is why nobody's gonna hire you anon
>>
>>51570789
The really cheap shit is well-placed in a fridge though...
>>
>>51570156
Become a web developer. It's programming on easy mode, and still pays well
>>
>>51570762
Hahah I chuckled. g'luck anon
>>
Question for those who've used Qt: Is qml worth using? Not too fond of using a ui designer (java ptsd) and qml looks like a quick way of manually coding the ui. I just don't know if there are any performance differences or maybe there are common things that qml can't handle.
>>
>>51568746
Sounds dumb but it can be done. If you pass shit to a function in the wrong order, say it's declared as (list, number, tuple) and you say (number, list, tuple). Python'll throw a fit. I fucking hate python.
>>
>>51570889
>webdv
>basically scripting in PHP and sql, sometimes Javascript
>"programming"
>>
holy shit
I did it, I managed to get a C program that compiles and runs correctly...without a main function!

The only problem is that it doesn't actually do anything.

There's no errors on compilation and no abnormal exits or whatnot when it runs, it just...well...does nothing.

Here's the code:
const _start(){
asm(
"movl $len,%edx;\n"
"movl $msg,%ecx;\n"
"movl $1,%ebx;\n"
"movl $1,%eax;\n"
"int $0x80;"
"ret;\n"
"msg: .ascii \"Hello, world!\\n\";\n"
"len = . - msg;\n"
);
}


Throw that into your GCC with the `-s` and `-nostdlib` flags and it'll give you a 984 byte executable that, when run, immediately exits normally.

How would I go about, you know, actually getting this to print "Hello, world!" to the stdout like it should? Any real C programmers out there or are you all just high-level pansies?
>>
>>51571746
1 is exit()
>>
>>51571746
>real C programmers
>code is pretty much assembly
>>
>>51571797
According to the contents of unistd_64.h, write is 1 and exit is 60.
>>
>>51571840

http://asm.sourceforge.net/intro/hello.html

1 is sys_write
>>
>>51571850
Yeah, that's what I'm going for.

Strangely, changing it to 4 results in "Hello, world!" being printed and then an immediate segfault.
>>
>>51571850
4*
>>
>>51571850
>>51571862

4*
>>
>>51571877
[~]% cat /usr/include/asm/unistd_64.h | grep write
#define __NR_write 1
#define __NR_pwrite64 18
#define __NR_writev 20
#define __NR_pwritev 296
#define __NR_process_vm_writev 311


4 is write on 32-bit machines. 1 is write on 64-bit machines.
>>
>>51571840
>unistd_64.h
You're using the 32 bit syscall interface.
>>
>>51571888
nice trips dude
>>
>>51571862
it's actually 4 I misread
>>
>>51571904
That must have been it.
With that knowledge I fixed the exit function to actually call exit(), and now it works:
const _start(){
asm(
"movl $len,%edx;\n"
"movl $msg,%ecx;\n"
"movl $1,%ebx;\n"
"movl $4,%eax;\n"
"int $0x80;\n"
"movl $1,%eax;\n"
"int $0x80;\n"
"msg: .ascii \"Hello, world!\\n\";\n"
"len = . - msg;\n"
);
}

[/tmp/devel]% gcc -s -nostdlib tmp.c -o tmp
tmp.c:1:7 warning: return type defaults to 'int' [-Wimplicit-int]
const _start(){
^
[/tmp/devel]% ./tmp
Hello, world!
[/tmp/devel]%


The binary is 992b, which is still larger than the raw asm but under 1KB so I'm satisfied.
>>
what happens to the preprocessor after c++ introduces modules?
>>
>>51571966
looks like gcc is adding a subroutine prologue/epilogue to the program
>>
>>51572074
Interesting.

Also, as usual, there's quite a bit of useless null characters "padding" the binary. I'll see how small I can actually get the binary myself.
>>
>>51572142
>>51572074
Because the string seems to be hard coded at 0000:0165, I can't get the executable to be less than 173 chars without tinkering with the actual code which is something I'm not knowledgeable enough to do.

I managed to get the 992 byte binary down to only 370 bytes by cutting out the null data and useless debug information, though, which is actually really impressive all things considered. 370B for a hello world program...
>>
>>51571966
>The binary is 992b, which is still larger than the raw asm but under 1KB so I'm satisfied.
You'll get a bunch of junk by default from gcc (build-id and gcc version string, which creates extra sections) and for x86_64 the abi mandates unwind tables for all functions (which aren't ever needed for a fully working program).
Compile and link with:
gcc -s -nostdlib -fno-asynchronous-unwind-tables -Qn -Wl,--build-id=none
That's 440 bytes without manual intervention.
>>
>>51572200
>01001000011001010110110001101100011011110010110000100000010101110110111101110010011011000110010000100001

woah scrub, a whole 370 bytes? I just printed it out using only 13, get the fuck on my level son
>>
>>51572260
Woah, thanks!
And from there when manually shortening the binary it drops down to a measly 223 bytes.

There's still a lot of null characters in the binary, though. I'm sure there's a way to cut those out.
>>
>>51572282
As I suspected, there is!

I found the byte that points to the beginning of the string. Moving the string to the middle of the program and manually changing that byte to the new location of the string resulted in a savings of about twenty bytes with no loss of functionality. I'm not under 200 bytes yet but I'll keep playing around.
>>
Code someone mentioned it is impossible to write swap function in Java. I beg to differ

import java.lang.reflect.*;

public class T{
public static void swap(int a, int b) throws Exception{
Field f = Integer.class.getDeclaredFields()[3];
f.setAccessible(true);
char[] t=(char[])f.get(null);
char temp = t[a];
t[a] = t[b];
t[b] = temp;
}

public static void main(String args[]) throws Exception{
int a = 5;
int b = 3;
int c = 1;

System.out.println("Values = a=" + a + " b=" + b + " c=" + c);
System.out.println("swap(a, b);");
swap(a, b);
System.out.println("Values = a=" + a + " b=" + b + " c=" + c);
System.out.println("swap(b, c);");
swap(b, c);
System.out.println("Values = a=" + a + " b=" + b + " c=" + c);
}
}


output
Values = a=5 b=3 c=1
swap(a, b);
Values = a=3 b=5 c=1
swap(b, c);
Values = a=3 b=1 c=5
>>
template<int s>
struct foo
{
void bar()
{
std::cout << "Bar";
}
};

template<> // why the hell is this <> ?
struct foo<3> // and what the FUCK is this?
{
void baz()
{
std::cout << "Baz";
}
};
>>
>>51572282
Read this
http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
>>
>>51572389
I did, but a lot of that's over my head. That program doesn't DO anything, it just runs and immediately exits. I understand the assembly behind my own program but how that actually translates to binary is beyond me, so right now I'm just chasing pointers in an attempt to catch the segfaults.
>>
A fresh build of my project now takes over 10 minutes. Kill me.
>>
>>51572482
don't worry. this will teach you how to efficient handle your includes
>>
>>51572546
That's true I guess.
>>
>>51572388
generics
>>
Let's say I want to write a simple chat client but I want to encrypt the messages.
What's the best way to do this?
- Encrypt the messages using some sort of public and private key that the people chatting have and know? I assume they'd make the keys with pgp or something similar.
- Use some popular library that already has a function for that and I only have to choose the algorithm.
- Don't encrypt anything and run the software over Tor.
- Forget about this because I clearly don't know shit about encryption.

I really don't care about the encryption part, and obviously I wouldn't think of implementing my own shitty algorithms, I just want to be able to encrypt messages. Dead simple
>>
>>51572372
nobody says you cant write a function to swap primitives. the insistence is that you can't do it without using an object
>>
>>51572482
I assume you have 100k lines of code and you are not fucking up with your dependencies or using some /g/ tier language
>>
>>51572891
as you can see in my code, a b and c are al ints.

And no, you can't also not really swap objects too
>>
>>51572886
An easy way to do it is to embed the key in the client and server. Sign all network traffic with the key so only the client and server can decrypt it.
>>
Teaching myself some modern c++, this compiles in g++, not in clang:

constexpr std::initializer_list<int> il={1,2,3};


If I do more complicated things similar to this than g++ starts to fail too without being too verbose of the error. Fuck this. I'm trying to write a library with literal types but I keep bumping into obscure errors.
>>
>>51572899
>I assume you have 100k lines of code
Yep. My tools say 200KLOC but that is probably including quite a bit of stuff which isn't compiled.
>>
>>51572911
>An easy way to do it is to embed the key in the client and server
So all clients use the same key? Then there's no point in encrypting the messages. Or am I missing something?
Oh and I'd like to avoid having a server
>>
>>51573010
I don't think it'll work for you.
Let's say your applications are A, the client, and B, the server. B checks the hash of the network request to validate the source, which should be A. Any other client is unable to interact with the server because it doesn't have the right key.
You should use something a bit more advanced like public/private keys. Client A signs the message with the public key of client B. Client B decrypts the message with its private key. Decryption is only possible with the private key, so only client B is able to read the message. Make it simple for yourself and use a library.
>>
>>51572372
>Field f = Integer.class.getDeclaredFields()[3];
why 3? what does the fourth element in the array of declared Integer fields represent? I really don't understand what's going on here
>>
>>51573136
so the server is mandatory right? Otherwise each client would have to know the IP of everyone in the chat.
I was thinking about using something like torrent trackers where they basically take care of making sure the clients know who are the clients who have the file parts they need and make them talk with each other
>You should use something a bit more advanced like public/private keys.
As I suspected. I only studied how RSA works in Discrete Math, but I assume there are far better algorithms by now to replace them.
Thanks for your help mate.
>>
>>51573330
Not really.
You only need to know the IP and port of 1 client. Lets say client A connects to client B. Client A has to know the port and IP of client B. There's no way around that. Now client C connects to client B. Client B notifies client A about the new peer. How the notification is done, is up to you. I assume torrent tracks work aswel.
>>
>>51573239
>why 3?
because I need the 4th element on that array
>>
Let's say I want to make a unoficial mobile version of a website in the form of another website that fetchs data through curl/ajax or whatever and I have to login into the original website through my website and post from my website to the original website

what should I study how to do this? is it even possible? what keywords should I use?

only found stuff for mobile apps but mine is an actual website
>>
>>51573807
>>/wdg/
>>/sqt/
>>
>>51568746
dynamic languages have types too.
>>
File: Valutron.png (17KB, 750x216px) Image search: [Google]
Valutron.png
17KB, 750x216px
>>51568507
I'm building a Lisp, called Valutron. I am implementing its compiler-interpreter in Objective-C.

It has some unique features: first, it offers what are called V-expressions, an alternative notation for writing code. Second, it offers a comprehensive object system inspired mainly by that of SmallTalk-80, one of the earliest Object-Oriented languages, and by Common Lisp's CLOS, Common Lisp being the first object-oriented language to be standardised.

This object model is implemented atop the Objective-C runtime, which I have extended with support for Double Dispatch to enable the availability of CLOS' characteristics multimethods.
>>
>>51574051
benchmarks when ?
>>
>>51574051
MODS
>>
>>51570644
VB

Anyone saying else is memeing
>>
>>51572388
implementation for specific value which means that for any s it will print "Bar" but for s=3 it will print "Baz"
>>
File: 1425824137905.png (103KB, 226x256px) Image search: [Google]
1425824137905.png
103KB, 226x256px
>>51574051
you don't have to spam that shit in every single thread if you don't make any progress or don't even suply a link to mess with it.
Pretty much everyone that browses this thread already knows about your "lisp"
>>
>>51574182
sorry but can't because Schroedinger.
>>
>Trying to teach myself DX12
>black screen
>Can't work out why it isn't clearing to white like I asked it to
Fuck...
>>
File: lambda-star-red-flag.png (23KB, 1920x1080px) Image search: [Google]
lambda-star-red-flag.png
23KB, 1920x1080px
>>51574182
I am making progress every day. Valutron embodies my emphasis on solid design and incremental improvement.

You can find the experimental source tree at https://github.com/JX7P/Valutron .

Be forewarned, it's not very useful right now as I am still in the design phase of building the new bytecode VM and its associated JIT compiler. I am documenting the design and implementation of these as well. Further, Valutron is somewhat large in scope, and so the source tree is in flux as I refine my designs.

Note that the new JIT should provide a 5-10* speed boost v.s. straight evaluation of trees, and should also enable the implementation of call/cc in a way that matches the semantics prescribed by Revised [6] Report on the Algorithmic Language Scheme.
>>
My C is a little rusty. I would appreciate if you could help.

I am making a data logger where writing speed and memory is essential. Should I call fprintf 10 times to write the different data or should I construct a char array and write everything at once?
>>
>>51574594
is it static typed?
What are V-expressions then?
>>
>>51574652
fprintf is probably already buffered
>>
>>51574555
And the moment I moan on /g/, i realize what an idiot I am. I was never transitioning the back buffers between render_target_output and present.
>>
>>51570644
It's no single language. Python and ruby are the most in demand alongside vb, but it really depends on the field and application. Fucking Lua has become the python of video games and pops up outside of it almost as much as python.
>>
>>51574688
Thanks. That makes it a lot easier.
>>
>>51574594
What's your motivation for the used license?
>>
Hey

I am shit in databases. For one client, I build a website in PHP/MySQL and I don't really spend too much time on it, it just runs on autopilot. (I am spending my time on another project that pays me 100 times more.)

Well, right now, they started to tell me that some actions take a long time. When I got a bit deeper, it seems like it's MySQL - some queries, pretty randomly, take a long time (about 40 seconds). Similar queries before and after are quick, so it's not regular, it's pretty random.

I installed munin to watch the load on the VM where it runs, and RAM, CPU, everything seems to be fine. I have no clue what the hell is going on and what should I do. I don't want to fine-tune the SQL queries now, because I don't want to touch the code at all if possible, especially the more low-level stuff like SQL queries.

I will probably just try to make innodb_buffer_pool_size larger and hope that it fixes things magically. But it pisses me off that I have no idea what is going on
>>
>>51574857
Sound like your queries are deadlocking.
>>
>>51574594
doesn't look like objective-c
>>
>>51574857
Doesn't PHP have something like profiler with data sampling?
>>
File: gay_lambda.gif (8KB, 648x432px) Image search: [Google]
gay_lambda.gif
8KB, 648x432px
>>51574655
V-expressions are an algebraic syntax available for use for code:

// let's define a 'get-hello-world' generic
defgeneric get-hello-world (object some-object) => string;

// let's define a 'hello' class
defclass hello (object)
{
slot string hello : initarg hello:;
slot string world : accessor getWorld, initarg world:;
}

defmethod get-hello-world (hello some-object) => string
{
let result = copy(some-object.hello);
append(to: result, some-object.getWorld);
result
}

let aHello = make-instance (hello: "hello", world: "world");
// the dollar $ is an alternative form of method dispatch syntax;
// it passes its (left-associative) pre-component as first argument
let aLambda = { () => integer | print(stdio, aHello$get-hello-world()); };
aLambda();


They appear to be statically typed, but in fact this serves as recommendations more than constraints due to the late-binding nature of Lisp. You could overhaul the type system and implement associated optimisations in theory, though.

>>51574906
That's true. I moved to C++ quite early on for various reasons. But calling it "Objective-C" elicits funny reactions from /g/
>>
>>51574908
I don't think I need a PHP profiler, I figured out the bottleneck are the SQL queries

Also it doesn't happen at development machine at all, only on production, and only in around 1/100 cases (or less), so it's hard to catch

>>51574874
Thanks, I will read on that.

(Again I am terrible with databases, I know some basic SQL syntax and that MySQL and Postgres exist, and that's where my knowledge ends)
>>
>>51574819
It fits with the theme of communism that Valutron is based around.
>>
>>51574983
do you accept donations ?
>>
File: ss+(2015-11-28+at+07.26.11).png (185KB, 1794x1306px) Image search: [Google]
ss+(2015-11-28+at+07.26.11).png
185KB, 1794x1306px
Work on making the flowchart thing for generating random maps has been going exceeding well.

The only thing I'm really missing at this point is the ability to make feedback loops.
>>
>>51575116
I don't see why not.
>>
>>51574963
>
    slot string world : accessor getWorld, initarg world:;

Could the last colon be omited? What's it for?
>>
Should I use references or copies if I'm not modifying passed variable?
>>
>>51575299
const reference
>>
>>51575299
Try it out and you'll know what to use.
>>
>>51575251
It specifies that the named parameter 'world:' may be passed to make-instance to initialise the 'hello' slot with a value.

I inherited the convention of including the colon from ISO Lisp Object System (ILOS). It doesn't seem very useful, though, so I can probably remove it and have the colon be added implicitly.

>>51575299
Pass-by-value, unless you need to store that variable somewhere and perhaps modify it later.
>>
>>51575309
My reply was a bit short sighted.
>>51575299
It depends. For the sake of concurrency, pass by value. Otherrwise, pass by const reference.
>>
>>51575299
by value is faster
>>
Is node.js the future of programming?
>>
I uploaded my language in its current state at: http://neetco.de/languagedev/language

1. There are design issues with the typenodes (MNode in pmf.h/cpp) which makes the code bloated, error-prone and leaky.
2. The primitives only work with int types. Beside, they're handled ad-hoc and bypass most of the code generation, which is also bug-prone and oogleh.
3. I haven't tested that it actually produces valid executables (but the llvm looks OK).
4. printf-and-continue-until-segfault is used instead of proper erroring,

build.sh provides the commands to run to build the entire thing. Only the last command is required if the .y (bison file) and .l (flex file) aren't touched.

The code is mostly written as almost-throwaway code so it's not pretty, but it should be understandable and workable.

The language's syntax is in the .y file. There is support for if-then, if-then-else, while, set!, let, lambda, type declaration (might not work, not sure) and function calls. Moreover, any symbol can be placed infix to represent an infix call without ambiguity under LALR(1):
let fn = lambda (x, y) x + y;
fn(3, 4) fn fn(8, 9);
\\should output the llvm IR for "7 + 17"

There are some simple to correct syntax flaws such as require ; after {} in if and while statements.

llvm_backend.h/cpp does code generation. No passmanager is used, so it outputs unoptimized code, which is especially useful for debugging.

I like the base syntax (beside some flaws that need to be addressed, as outlined above) so far, but the codebase is starting to be hard to work with. Next up is probably, implementing multiple dispatch and type translation (e.g. <number> = <u>(<long>, <double>) should unify the union type, not the <number> type, with whatever argument is used in a function call).

Any pull request, patches, or suggestions would be appreciated, especially in how to cleanup the code.
>>
>>51575351
Unless it gets concurrency, no.
>>
>>51574963
What's the purpose of this code?
// let's define a 'get-hello-world' generic
defgeneric get-hello-world (object some-object) => string;
>>
>>51575382
WebWorkers are a thing. Memory shared multi threading is being worked on for future versions of ES.
>>
>>51575382
It has workers.

https://nodejs.org/api/cluster.html
>>
>>51575396
Not him, but smalltalk-style OOP means you define methods on generics, not on objects. Typically, generics are automatically made for you the first time the compiler encounters a method definition with an as-of-yet unseen name in good languages, though. Think of it as an abstract base class's function, except it's really not in and of itself related to the object, which allows extending the message passing framework over any existing object type without modifying the library which introduces that type.
>>
>>51575396
It defines a generic function. These constitute methods that are unassociated with classes.

Similar to C++ templates, whichever specialisation (as defined with defmethod) is most specific to the types specified in an invocation of the generic is the one that is called. This is achieved through the Double-Dispatch mechanism.
>>
>>51575351
yes, don't listen to >>51575382, the guy does the usual confusion between concurrency and parallelism. (And even that, nodejs has parallel computing).

http://techblog.netflix.com/2015/08/making-netflixcom-faster.html
>>
>>51575407
>>51575412
Interesting...
>>
struct Parser<'a> {
source: &'a str
}

enum Token<'a> {
Literal(&'a str)
}

impl<'a> Parser<'a> {
fn parse_a(&mut self) -> Option<Token> { None }

fn parse_b(&mut self) -> Option<Token> { None }

fn parse(&mut self) -> Option<Token> {
if let Some(x) = self.parse_a() {
return Some(x);
}
if let Some(x) = self.parse_b() {
return Some(x);
}

None
}
}


error: cannot borrow `*self` as mutable more than once at a time
if let Some(x) = self.parse_b() {
^~~~
note: in expansion of if let expansion
note: expansion site
note: previous borrow of `*self` occurs here; the mutable borrow prevents subsequent moves, borrows, or modification of `*self` until the borrow ends
if let Some(x) = self.parse_a() {
^~~~
note: previous borrow ends here
fn parse(&mut self) -> Option<Token> {
...
}
^


Can someone explain to me why this doesn't work? The borrowing/lifetime semantics of rust confuse me.
>>
>>51575423
>Not him, but smalltalk-style OOP means you define methods on generics, not on objects.
But why? Is there any good reason not to have them generated automatically?
>>
>>51575299
It depends on how big the object is.
>>
>>51575459
I haven't added automatic generation yet but I will do in the future.

The major virtue of defining them in advance is to, for example, constrain the possible specialisations available. Think of C++09 concepts in this case.
>>
I was reading about unit tests and encountered a problem. How do you know what to test and how to test certain things.
For example in graphics, how do you test if something is being drawn correctly? You can test every mathematical operation being used on their own easily, but what about the combination of operations?
And for example in networking, do you make tests for all the smaller components and then assume the data are being correctly transmitted. Or you make a test using some Port on your own machine and test if it gets there.
>tl'dr how to write unit tests for a complete system
>>
>>51569865
codeeval.com
>>
>>51575563
>For example in graphics, how do you test if something is being drawn correctly?
Compare against a "reference" image. If you're talking about 3D rendering, that would be an image rendered by a path tracer.
>>
>>51575563
Graphics testing is a whole area of research. The usual "dumb" approach is to manually render and check the validity of an image, then use that image as a reference and allow up to x% per-pixel deviation in the render (different hardware render differently).

For other forms of testing, it's about path coverage.
>>
thesis: rustlang is a theoretically nice language whose community is overrun by mediocre webdevs who see it as a lazy shortcut to get into systems programming without having to learn all the low level stuff.

i'm disgusted.
>>
>>51575187

Where the fuck did you get that flowchart control?
>>
>>51575563
For networking you usually test all the basic functions like your protocol handler, and then assume the OS correctly pushes your bytes down the pipe.

You'll have some end-to-end tests that verifies this separate from the unit tests.
>>
>>51575596
>>51575610
ok, thank you
>>
Question.
What exactly is a parameter?
Say I have a function
func(func(a+b, a-b), func(a*b, a/b))
Are there 4 or 8 parameters? Or is it 2?
Halp
>>
>>51575563
In my current company, we don't test at all.

Not enough time, we are a start-up, move fast break things LOL XD

I hate that. But I will not start doing tests either, the system is quite big right now and everyone is telling me (directly and indirectly) tests are useless and I should not do them

So fuck it
>>
>>51575727
>So fuck it

That's the right attitude.
>>
>>51575723
Each call to func() has two parameters. So (and this is a pretty useless number) there are six parameters overall: a+b, a-b, a*b, a/b, and the values of func(a+b, a-b) and func(a*b, a/b).
>>
>>51575723
Who cares, really.

The function "func" has 2 parameters.

But if you want "total parameters", it's probably 6, as this guy says
>>51575736

but again it's a useless number.

func has two parameters and that's what is important.
>>
>>51575736
>>51575768
thanks peeps. It's definitely a number you don't need to know but I have a computing exam coming up on Monday and they ask these kinda things. Thanks again
>>
>>51575736
>>51575768
the correct answer was "there is no way to know without function definitions" because there can be always defaulted parameters.

I will give you B- for your answer though
>>
>>51575802
Is defaulted parameter a parameter if nobody knows about it?

And does it make a sound?
>>
>>51575802
>because there can be always defaulted parameters
Maybe in your language, not in "CS in general".
>>
>>51575727
tests are largely useless. At least, i reckon they are massively over used. The amount of time it takes to write and maintain a suite of tests is very high, and you could easily spend the same time just making the code base more robust and leverage the type system more (types are tests).

They definitely have a place is a large, well designed system where certain things cannot be easily be made as robust with good code alone. In that case tests are hugely useful. Most of the time they are a waste though. You're company is probably right to be skipping them.
>>
>>51575681
thank you too mate

>>51575727
>Not enough time, we are a start-up, move fast break things LOL XD
> hate that. But I will not start doing tests either, the system is quite big right now
well if your company had written tests while the system was growing that wouldn't have happened
>So fuck it
How the fuck do you even change something in the code? I'd shit myself knowing I could break it all
>>
>>51575812
yes it is, you are confusing parameters with arguments. function definitions have parameters, function calls have arguments
>>
>>51575821
Remember kids, don't be this guy: stay in school.
>>
>>51569263
;_;
>>
>>51575840
Good counter argument.

I'm 29 and have a great job that i love.
>>
>>51575814
lots of languages support defaulted parameters. So, if it is "CS in general" you should keep that in mind while answering questions
>>
>>51575631
https://github.com/LogicalError/Graph
>>
>>51575862
You have no idea what CS even is, so top kek to you.
>>
File: finished.png (369KB, 320x386px) Image search: [Google]
finished.png
369KB, 320x386px
Decided to monkey around with my palette thinger from yesterday.

Apparently the correct technique is to use HSL, rather than RGB, because the distance will produce images that are off-color (warm, or hot, depending on your input palette) but more closely match the original image in terms of shape. Not only that, but working center out is also important.

Haven't taken to implementing that, though, so here's American Gothic with the Starry Night palette.
>>
WE TEXT BOARDS NOW
BRING BACK PROG YOU FUCKS
>>
>>51575802
>>51575862
In all of them when the function has a parameter that can be omitted, multiple versions of that function are generated: with and without. If you call the function with omitted parameter, exactly the amount of parameters you specified are sent to function.

>I will give you B-
You are a colossal retard.
>>
>>51575908
How's that communism working out for ya?
>>
>>51575866

How did you uncover this chestnut? I looked around before but could never find anything.
>>
>>51575908
Dude you still alive ? Holy shit.
>>
>>51575922
>>51575943

Wait, what? Did something happen last night that I missed?
>>
>>51575936
Lots and lots of google searches. I filtered a ton of over-engineered bullshit before I discovered this gem.
>>
>>51575908
I hope you're not calculating distance between colors by converting them to HSL and just getting difference or squared difference of three parts.
>>
>>51575831
Oh. Yeah. This is the first time I am hearing it's a different thing.

I thought it's a synonym.

And I code for about 20 years now.
>>
>>51575960

It really is beautiful. Looks great for plugin-type applications.

Thanks, m90. Always nice to discover good controls.
>>
>>51575957
You been here like 7-8 months I tought you may have died or something haven't seen in you while
>>
>>51575988

Mine just calculates the absolute difference between two colors in RGB. No trickery involved, right now.
>>
>>51576020
But why were you talking about HSL?
>>
>>51575825
>well if your company had written tests while the system was growing that wouldn't have happened
Yeah, but I came later when it was already giant

> How the fuck do you even change something in the code? I'd shit myself knowing I could break it all
Yeah I was like that too. And it did break. A lot.

But I started to use Flow (basically type system in Javascript, like TypeScript, made by Facebook) and it really catches a lot of errors, at least the most common ones

I had to fix actual bugs in Flow to make it work on our code though. Thanks God for github, now it's on mainstream
>>
>>51576008

I'm here every day, though. You can never get off Mr. dpt's wild ride.
>>
>>51576031

Because apparently that's the 'correct' way to do it. Either that or CIELab delta e.

Colors are gay, desu.
>>
File: duo.png (210KB, 1280x1024px) Image search: [Google]
duo.png
210KB, 1280x1024px
using the duolingo json api as it misses out words from vocab
>>
>>51575821
I wrote a small math parsing library, kinda like what https://github.com/Khan/KAS does (although that library is 100x the size of mine, and now I've abandoned mine for this)
I had a small suite of tests, and it was quite helpful in building it. I could confidently change a lot of code and then ensure that the program still worked fine. Without tests, I could never make large changes like that.
The final result was used in a node based thing like >>51575187. I shared it here a while back

anyway, unit tests are good. keep them small and easy to maintain, and have a CI server run the suite on every change you make. I use circle-ci.
>>
So how many of you work in a sales driven technology company?? what's your experience with salesmen??
>>
>>51576068
It's very far from correct. In practice, this will get horrible results.

Web RGB #030202 is hsb(350,0.39,0.01)
Web RGB #030402 is hsb(90, 0.50,0.02)

The difference between 350 and 90 degrees is huge (that of course is assuming you scale 0-360 to 0-1), but those two colors are practically the same - black.

Same applies to HSV (I just can't give you precise HSV values because photoshop only has HSB).

Here's some good reading with interactive javascript comparison thing: http://stevehanov.ca/blog/index.php?id=116

LAB is great, RGB is good and HSV/HSB produces horrible results.
>>
>>51575918
that is wrong. function is still same. same binary. callers uses default parameters given in function definitions if it is missing some arguments
>>
>>51576142
We sell to government. No experience. I am a programmer.
>>
>>51576142
Our company builds apps for other companies. Does that count?
>>
>>51576154
There are multiple functions generated in binary.
>>
>>51576154
>>51576189
really depends which language and compiler...it's not an open and shut thing
e.g. the compiler determines a default parameter can be inlined in the function instead of wasting space in the stack, so it creates a whole new function which should theorectically run faster because of less bloat

if you know of a language/compiler which does create different functions for different number of params, link to the source so we can verify
>>
>>51576189
Not for me. With g++ I am getting this.

void t(int c = 5){
}
t(2);
t();


produces

    movl    $2, %edi
call _Z1ti
movl $5, %edi
call _Z1ti
>>
>>51576172
Yes, so does mine, but your company will have salesmen / marketeers to seel it. My personal opinion is techies should take the greater role, but none techinical salesmen selling tech products. What is /g/s experience with being in this enviroment?
>>
>>51576238
Turn off inlining.
>>
>>51576142
We are sales-driven, but we have no salesmen because we are targeting very niche community where we have, so far, a monopoly, and all people that need us basically know about us.

Also the issue is that the community of our users is on one hand very niche, on the other hand all over the planet.

So yeah we have no salesmen and are very VERY technology driven. Which is cool.

The bad side of our company is this
>>51575727
>>
Has anyone here ever made something useful using genetic algorithms?
>>
>>51576253
>call
>inline
>>
(def little-schemer {:title "The Little Schemer"
:authors [friedman, felleisen]})

(defn add-author [book new-author]
(let [[author name] new-author]
(assoc (:authors book)
author name)))

(add-author little-schemer {:name "Gerald J. Sussman"})


java.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap

help?
>>
>>51576296
It looks like you're using lisp.
>>
>>51576253
>call _Z1ti
>_Z1ti
> inlining
dude, never post here again. ever.
>>
>>51576296
>he fell for the clojure meme!
>>
>>51576242
I'm a dev, but I visit customers frequently. Not to shill products, but to listen to their requirements.
We have a few salesmen. They know absolutely nothing about technology except what's in the tech sheet. Even worse, they talk shit about developers.
>>
>>51576340
>Someone makes a mistake reading asm
>Tell him to never post here again

I'm not even that guy, but fuck, I bet 50% of the people here can't even write a trivial piece of code in their assembly language of choice, lay off the guy
>>
File: 114.jpg (635KB, 1920x1200px) Image search: [Google]
114.jpg
635KB, 1920x1200px
>>51576281
https://en.wikipedia.org/wiki/Evolved_antenna
>>
>>51576349
but it combines readability of lisp with efficiency of Java!
>>
>>51576372
Hey! I made that too.
>>
>>51576389
It actually kills lisp readability and performs 10x slower than java. Literally the worse of both worlds.
>>
>>51576389
Are you implying Java code is more difficult to read than >>51576296?
>>
>>51576281
Yes, just like people have made useful things with opendylan.
>>
>>51576450
>that_is_the_joke.gif
>>
>>51576450
>10x slower than java
http://benchmarksgame.alioth.debian.org/u64q/clojure.html
>>
How difficult would it be to create an app for both osx/android from scratch?

I have no experience with xcode or swift or any of that, but I'm in my final year of engineering so I do have a decent handle on C/C++/VBA and python

The app would have a purse which you can add money too and micro-transactions would occur based on that.

Think sort of like uber
>>
>>51576482
Fine, 3x slower. Same shit.
>>
>>51576361
salesmen sell shit that doesn't exist, at the place i work they want to push shit out at fast paces, there is no time for proper testing. I've been there 3 months now and so much old stuff is unecure and exposed to being attacked. Everything is on one server, not joking, it wont take much for this place to fuck up.

To the people running the place it feels like the only thing that counts is making more money and speed things up. Clients come back and our work is tied and still expect us to make an app in a week with loads of bespoke stuff. feels like you're making junk.
>>
>>51576519
Uber for money

Why did nobody ever thought of that???
>>
>>51576519
Impossible.
>>
>>51576450
S-expressions are awful for code. They're best suited to being used for data and as a view of the internal representation.

Open Dylan proves that you can get all the Lisp benefits (and even hygienic, ultra-powerful macros) without the stupidity of S-expression code.
>>
>>51576519
>>>/hn/

also you can use c++ for both
>>
>>51576519
On a related note

How difficult is Cordova, and how efficient is it on today's phones?

I heard it's kinda slow and inefficient, but I never tried it. And I already know JS/CSS/HTML because I do that stuff daily, while diving "back" into objective-c/dalvik java, I will not be so effective in those
>>
>>51576543
S-expressions are literally perfect for code. There does not exist a better representation whatsoever. They're perfectly unambiguous and require only 2 syntax markers, they make refactoring almost automatic with 0 tools, and they work bloatless with any programming paradigm currently in existence. They even make it ridiculously easy to serialize and deserialize data as well as making syntax manipulation trivial.
>>
>>51576543
>S-expressions are awful for code.
i found them to be quite goods. it's easy to write tools for s-expression where parsing is a joy.
>>
>>51576539

I'm not sure what you mean, it's for a different service than a car ride, I just don't feel like posting my idea here. Just for the sake of argument assume it functions sort of like uber.

>>51576549

hn?
>>
File: IMG-20151118-WA0017.jpg (14KB, 320x331px) Image search: [Google]
IMG-20151118-WA0017.jpg
14KB, 320x331px
Why are there no squiggly lines under errors in emacs flycheck?
>>
>>51576574
The only thing I really hate about S-expressions is that they don't work well with type annotations
>>
>>51576582
>Open Dylan
http://kivy.org/#home
>>
>>51576528
Same here. We build apps for others, so the goal is to finish the project as fast as possible. Taking shortcuts is a must since the deadlines are insane. There's no budget for unit/UI tests, so we bash the screen and see if it is still working decently.
It's a real shame though. I like creating a nice architecture, but that takes time. Time we don't have. Also the quality of 'app developers' isn't really top notch. I guess that's what you get for building apps.
I'm still amazed at how many high profile clients we have.
>>
>>51574215
ayy
>>
File: 113.gif (218KB, 300x100px) Image search: [Google]
113.gif
218KB, 300x100px
>>51576372
>https://en.wikipedia.org/wiki/Evolved_antenna
>>51576430

Thanks that is really neat.
>>
>>51576571
cordova is deprecated
react-native is what you should use now
>>
>>51576598
I don't agree. I think chicken- or racket-style type annotations are fantastic:
(: fn (-> int int int))
(: fn2 (int int .->. int))
(define (fn x y) (+ x y))
(define (fn2 x y) (* x y))

Even inline annotations work quite well:
(lambda ([x : int] [y : int]) #{(+ x y) : int})

But shouldn't be necessary. Top-level items and variables should be markable, but return types and intermediary types should usually be inferred.
>>
>>51575908
HSL is a meme
>>
I was in Asia for three trips (Vietnam, Hong Kong, Taiwan) and I loved it there

How can one find an IT related job there? Is it good idea?

I will take China (mainland), Hong Kong, Vietnam, Singapore, Taiwan. Maybe those other countries with less Chinese influence (Malaysia, Thailand) but I have never been there so I don't know. Korea and Japan - I don't know, I heard they work like crazy there
>>
>>51576679
I just think the prefix : and -> look silly
>>
>>51576679
Is that for typed racket? I love how it's similar to Haskell
>>
>>51576693
Bump for interest.
>>
>>51576711
Yeah, it's typed-racket. Chicken's look similar.
>>51576696
That's just the baby duck talking.
>>
>>51576741
În this case, why ever use regular racket instead of typed racket?
>>
>>51576693
Try huawei or baidu. They're the big guys in terms of tech over there.
It's a very bad idea. You'll have to accept that your job will mostly consist of spying on people, advertising for druglords, being complicit and hiding the company's illegal activities.
>>
File: Equation1.jpg (29KB, 325x252px) Image search: [Google]
Equation1.jpg
29KB, 325x252px
>>51576741
No, it's the type theorist talking

Granted, -> can be written as prefix Π, but I still prefer the infix arrow Agda-style
>>
>>51576767
>Try huawei or baidu
Haha.

One Chinese IT guy I met in Vietnam specifically told me not to work for Huawei because they work a lot with a little pay there

Baidu is cool though
>>
>>51576767
>You'll have to accept that your job will mostly consist of spying on people, advertising for druglords, being complicit and hiding the company's illegal activities.
Let's be honest though the only difference everywhere else in the world is that they're somewhat more covert about it there.
>>
>>51576683

So I've heard.
>>
>>51575727

I hope you realize there are college students out there you could give internships to in order to carry out tasks like those.
>>
>>51576633
The company I work for as high profile clients as well. The funny thing is when we give them something to test you'd expect them to have teams testing it for different scenarios. For example UI testers, penetration testers.

But what really happens is some cunt that's managing it gets a friend and their family member to test it on their device, and these clients are high profile nation wide guys. It's so supprising.
>>
>>51576764
Typed racket is actually very bad, the type system is both very weak, being unable to express many kinds of types, being unable to resolve transitive type equivalence (union of unbox-type of box A and unbox-type of box of B v.s. unbox-type of box of union of A and B are not compatible, for instance), and being unable to form some types outright (for instance opaque structs cannot be passed back to untyped code during a call to a function in that same untyped code because the opaque type is not formed correctly), you also have to choose per-file if you want types or not, there's a massive cost to going form typed to untyped racket due to having to transform type tests into runtime contracts, and another in going in the other direction (+ dev overhead) because you have to specify contracts to run when importing objects from untyped code to determine the type. Also, you often have to add pointless code to get the type engine to correctly detect the types such as if you have a union of A and B and you want to do fna if it's an a and fnb if it's a b, you can't use if-else, you have to use if-a-else-if-b-else. More importantly, even when a type is trivially guaranteed and you expect the type system to detect it, you still have to insert if/elseif pointless tests to convince the typesystem of the right type to detect, and you have to add type annotations (#{... : ...}) way too often.
>>
What am i doing wrong here? I'm trying this exercise in a book, but i'm having trouble with passing the pointer to functions into the vector:

#include <iostream>
#include <vector>

using namespace std;

int foo(int x, int y)
{
return x + y;
}

int add(int a, int b)
{
return a += b;
}

int sub(int a, int b)
{
return a -= b;
}

int multiply(int a, int b)
{
return a *= b;
}

int divide(int a, int b)
{
return a /= b;
}

int main()
{
typedef int(*pf)(int, int);

vector<pf> v{ add, sub, multiply, divide };

for (vector<pf>::iterator iter = v.begin(); iter < v.end(); ++iter)
{
cout << iter(2, 2) << endl;
}

return 0;
}


excuse the messy layout, it's just a small exercise.
>>
>>51576810
You mean 'overt'.
>>
>>51576871
you can't do that
>>
>>51576887
You're right. Been a long day, sorry.
>>
>>51576892
I got it to work using:

#for (auto f : v)
{
cout << f(2, 2) << endl;
}


I know why the iterator thing isn't working, but i wanna know why the auto works. What type is f when used with auto then?

I know i could just roll with auto, but i don't like using it. Not until i'm more comfortable with c++ and i better understand how my code works at least.
>>
>>51576871
Use std::function.
https://ideone.com/79qLVr
>>
>>51576871
 cout << (*iter)(2, 2) << endl;
>>
>>51576845
Usually the product manager 'tests' the application. I've no idea how they test but it's shit.
iOS builds are usually tested on their own devices. 99% of all manager I've met have an iPhone. Android builds are usually tested on a borrowed phone. I occasionally receive mails stating the app doesn't install on their borrowed phone. No shit, it's Android 2.2 with a LDPI screen. We only support Android 4.1 and higher.
What kinda applications do you build?
>>
>>51576925
because range for loop is defined by the standard as:
[code[auto && __range = range_expression ;
for (auto __begin = begin_expr,
__end = end_expr;
__begin != __end; ++__begin) {
range_declaration = *__begin;
loop_statement
} [/code]

note the *__begin
>>
File: kawa_logo.png (12KB, 920x704px) Image search: [Google]
kawa_logo.png
12KB, 920x704px
>>51576679
>>51576598
kawa

(define (Foo x::int y::int) ::float
(->float (+ (* x y)
(- x y))))
>>
>>51576845
plebs have too high expectations of "the elite". it's dudebros all the way to the top
>>
>>51576953
>>51576932
Oh, wow i'm retarded. Thanks guys, i get it now. Christ maybe i'm just too dumb for this stuff, i keep making stupid errors like that.
>>
>>51576941
I do the web platform, but we build IOS and Andriod. I don't want to say exactly what the product is, there are quite a few other companies do the same thing from what I'm aware of. The manager gets pissy when he finds other competition doing the sme thing. But it's a decent idea and something alot of companies are interested in, we have some big names in my country and abroad that want the app.

I would ask you but I'm guessing you'll probs not want to give much away. and yes how they test it is rediculs.

A few weeks ago the client had a cried my web features didn't work in IE 8 in their "amazing" IT studio. So yeah
>>
New thread: >>51577055
Thread posts: 327
Thread images: 32


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.