/dpt/ - Daily Programming Thread

Old thread: What are you working on Cred Forums?

Other urls found in this thread:

vidarholen.net/contents/wordcount/#gentoo,debian,ubuntu
vidarholen.net/contents/wordcount/#int
vidarholen.net/contents/wordcount/#struct
vidarholen.net/contents/wordcount/#recieve
vidarholen.net/contents/wordcount/#bitch
vidarholen.net/contents/wordcount/#slut
vidarholen.net/contents/wordcount/#nigger
vidarholen.net/contents/wordcount/#spooky
kernel.org/doc/Documentation/CodingStyle
vidarholen.net/contents/wordcount/#anime
vidarholen.net/contents/wordcount/#spic
vidarholen.net/contents/wordcount/#gook
vidarholen.net/contents/wordcount/#piss
fileformat.info/info/unicode/char/2215/index.htm
github.com/torvalds/linux/search?utf8=✓&q=anime
akaribbs.mooo.com/
pastebin.com/mJ6A7Hj1
gnu.org/software/gsl/manual/html_node/Hypergeometric-Functions.html
projecteuler.net/problem=44
better-dpt-roll.github.io/
youtube.com/watch?v=Wh_1966vaIA
twitter.com/SFWRedditVideos

Thank you for using an anime image

i'm not going to have to save equations in my calculator am i

I added code tags and a rudimentary spam filter to akari-bbs!

Still testing it before I push it to the site.

It is the default and traditional DPT image.

django tutorial

Not remotely Cred Forums related you fucking faggot
Go back to your containment subreddit

I made a tool that lets you view the number of times a word is mentioned in the Linux kernel source over time:

vidarholen.net/contents/wordcount/#gentoo,debian,ubuntu

Anime is for pedophiles and man children, who use it as a substitute for the love and social life they never had.

interesting

>vidarholen.net/contents/wordcount/#int
>736303

>C

>vidarholen.net/contents/wordcount/#struct
>1436661
>1, 436, 661

>C

anime a shit. :^)

Structs were a mistake. If only we could go back to the early versions of C that didn't have them.

New to programming, so make compiles the program and install puts it into the correct directories, right?

In April 2011, someone was fed up with people misspelling "receive":
vidarholen.net/contents/wordcount/#recieve

In 1998 and 2000 there were some huge spikes in the word bitch:
vidarholen.net/contents/wordcount/#bitch

Apparently it was due to a macro for complaining about unhandled instructions:

+/* Complain about yet unhandled instruction. */
+#define BITCH(insn) \
+insn: LOCK_KERNEL; \
+ la a1, 8f; \
+ TEXT(#insn); \
+ la a1, nosim; \
+ UNLOCK_KERNEL; \
+ j done

How do you guys handle storing login information for various websites?

Right now I have several different applications written in PHP, Java, and Python "credentials" classes that can all access the same logins.txt file, which has passwords in plaintext, in the form:

website | type | login | password
mysite.com | sftp | poopypants | hunter123
mysite.com | api | poopypants | djijd98yhdsn8h

Then I just do:

logins creds = new logins();
creds.setLogin("mysite.com", "api");

Do you guys use a database or something with encrypted values? I wonder if I should switch to that.

The graph for 'fuck' is pretty interesting.

wow dude

look up mum and dad

the 'gay' and 'fag' graphs are great, they've just been increasing at a steady rate. also interesting: vidarholen.net/contents/wordcount/#slut

>40 and 70 uses respectively

FOR WHAT POSSIBLE RAISIN?

First time coding in C, what's a good compiler for it?

Tbh, I'm a bit disappointed at this graph: vidarholen.net/contents/wordcount/#nigger

Or rather, the lack thereof.

They used 'shit' 42 times in 2004.

occurrences in the middle of other things

>usLutStartIndex
>usLutLength
>usLutOffsetInVram

>u slut
>u slut
>u slut

This one is cool
vidarholen.net/contents/wordcount/#bitch

It's not user's logins, just around 6 of my own logins for APIs to different sites.

vidarholen.net/contents/wordcount/#spooky

Officially despooked.

You're retarded. There is nothing wrong with structs, they're defined in assembly as well since structs are just a set of variables stored under one name in one contiguous block of memory to be accessed together.

It's also part of the Linux coding guidelines you don't typedef them, which is good advice in general, which is why struct appears so much in the code.

See chapter 5 of kernel.org/doc/Documentation/CodingStyle

>vidarholen.net/contents/wordcount/#gentoo,debian,ubuntu

>todo
>5.3k matches
I should switch to MINIX ...

>try to input "no" , "ok"
>Sorry, each word must be 3+ characters long.

INTO THE TRASH IT GOES

What is the best OCR library for python 3?

>which is good advice in general

Bindings to Tesseract.

I wrote a Java application that simulates the software running inside an electronic door look. To what extent am I allowed to pass this off as embedded software experience?

pic related is the GUI that represents the door lock.

not an argument.

vidarholen.net/contents/wordcount/#anime
The official kernel of Cred Forums.

READ THE FUCKING GUIDELINE CHAPTER REFERENCED IN MY POST YOU FUCKING SHITHEAD.

Well clearly we need someone to add kike and nigger to the linux kernel.

Spic did manager to make it into the kernel however.
vidarholen.net/contents/wordcount/#spic

Your first mistake was responding seriously to something that was obviously meant to be stupid.

shart in mart

All I'm seeing is stupidity

as did gook: vidarholen.net/contents/wordcount/#gook

Ironic stupidity is still stupidity.

pee in c

In your favorite language print without being a stupid nigger
Lolicon
nLolico
onLolic
conLoli
iconLol
liconLo
oliconL
Lolicon

What if I'm not a pedo?

> vidarholen.net/contents/wordcount/#piss
>3

#!/usr/bin/env python3

import sys

def rotate_print(s):
for i in range(len(s),-1,-1):
print(s[i:] + s[:i])

if len(sys.argv) > 1:
rotate_print(sys.argv[1])
else:
print('Argument required')


$ ./rot.py Lolicon
Lolicon
nLolico
onLolic
conLoli
iconLol
liconLo
oliconL
Lolicon

...

>>> x = 'Lolicon'
>>> for i in range(0, len(x)+1): x[i:]+x[:i]
...
'Lolicon'
'oliconL'
'liconLo'
'iconLol'
'conLoli'
'onLolic'
'nLolico'
'Lolicon'
>>>

#include
#include

int main(int argc, char *argv[])
{
const char *str = argc > 1 ? argv[1] : "Lolicon";

for (const char *ptr = str + strlen(str); ptr >= str; --ptr)
printf("%s%.*s\n", ptr, (int)(ptr - str), str);
}

IT'S WROOOONG

How the fuck do I implement confluent hypergeometric functions in C++? I tried to use the gsl_sf_hyperg.h (which doesn't fucking exist) or tried to build it up from scratch via definitions (which doesn't fucking work). Below is how I tried to define the even parabolic cylinder function.
unsigned int factorial(unsigned int n)
{
if(n == 0)
{
return 0;
}
else
{
unsigned int ret = 1;
for(unsigned int i = 1; i

its wrong user

soltn s = unlines $ map (uncurry (flip (++)) . (`splitAt` s) . (n-)) [0..n]
where n = length s
andPrintIt = putStrLn . soltn
-- andPrintIt "exampleString"

it's just sliding from the other side
this is art

He's a frogposter, what did you expect?

ANSI fucked up the -_ =+ keys

they should have been _- =+ or something

I don't understand why this directory isn't being found.

this is happening with the savepath in
File.Copy(currentPath, savePath);


any clue as to why this is?

>9/22/2016
not a valid filename on windows

MOTHER FUCKER

stupid robot

Welcome to windows file paths, enjoy your stay

>month/day/year
Use ISO 8601 you stupid fucking american.

Sounds more like user error.

ok new problem anons, with "123456789" should output
147
258
369

Looking to learn to program. Is SICP worth it if I want to learn a language that has industry use off the bat? For example, my college course this semester will teach intro to programming concepts using java. Should I practice with that?

Prove that those slashes aren't fileformat.info/info/unicode/char/2215/index.htm or any other non-ascii slash character.

That character doesn't even look the same.

import qualified Data.List as L

splitEvery [] _ = []
splitEvery xs n = front : back `splitEvery` n
where (front, back) = splitAt n xs

soltn = putStrLn . unlines . L.transpose . (`splitEvery` 3)

>Is SICP worth it if I want to learn a language that has industry use off the bat?
No

import math
m = '123456789'
r = int(math.sqrt(len(m)))
for s in range(r):
print(m[s::r])

How can you live with this? It's so ugly

How is it?
The main part of the solution (splitEvery or similar should really be in prelude desu) is just this:

putStrLn . unlines . transpose . (`splitEvery` 3)

Split the string into strings of length 3, transpose that list of strings, unlines it (join them with line terminators) and put the resulting string into the console

Here's a generic version using the Split package

import qualified Data.List as L
import qualified Data.List.Split as L

soltion s = putStrLn . unlines . L.transpose . L.chunksOf n $ s
where n = floor . sqrt . fromIntegral . length $ s

who /perl/ here?
Are there any particularly good learning resources for it? I've been trying to teach myself by using project euler but when I try and google to troubleshoot issues I bump into haskell-levels of crazy looking code.
I need a good baseline to start with.

ok i swapped -_ in autohotkey but only when caps lock is toggled (for typing MUH_MACROS)

$-::
if GetKeyState("CapsLock", "T")
send, {_}
else
send, {-}
return

$_::
if GetKeyState("CapsLock", "T")
send, {-}
else
send, {_}
return

>in javascript NaN is the only object not equal to itself
>the correct way to test for NaN is to use isNaN()
why is this language so dumb?

that's how floating point works it's not javascript's fault

Unreadable monad comprehension edition
solution2 = [ pure . putStrLn . unlines . L.transpose . L.chunksOf i | i

whoops, remove "pure . "

PLEASE respond ;-;

Implementing parallel compression in HDF5. One never truly learns C until swimming through a sea of function pointer magic.

read sicp and learn scheme. java is for wagecucks

It's just someones email.
github.com/torvalds/linux/search?utf8=✓&q=anime

learn based java

Is scheme a good scripting language for games?

Not necessarily, If I were you I would look up your specific compiler.

not really

What would you recommend? I don't like the look of lua

"games" is pretty broad user

Computer games

Like how with most games you can write scripts to include in levels or areas

interpreted C

square root of pq over n, user

>write ray tracer on cpu
>"wow this is pretty nice, now let's add a bit of pthreads"
>scheduler makes the threads run sequentially

what did i do to deserve this

>sequential multithreading

#include
#define S "Lolicon"
main () {
char* t = "\0" S S + 8;
do
fwrite(t, 1, 7, stdout), putchar('\n');
while (*--t);
}

ok

don't ask Cred Forums for advice
just use lua it's super easy to include with C
or use guile if you're an asshole

ok

If you're looking for an embedded language, TinyScheme is great! The API is simple stupid, and the source code is easy to hack because it's literally only 4-5K lines of C. It is nonetheless ridiculously powerful, which is why it was chosen as the base of GIMP's scripting language, script-fu. It was also used as a scripting language for an adware program distributed to over a million computers, thus making it the most distributed Lisp-based programming language in existence.

It might not be the best Scheme. It doesn't have hygienic macros, nor does it implement any of R6RS or later, but for something simple that can be embedded in a C or C++ program, TinyScheme is the best!

>It doesn't have hygienic macros
What's the fucking point, then? Lisps are garbage without macros.

keyword hygenic
of course it has macro's, it'd be fucking ridiculous to build a scheme without macros.

>Lisps are so good you guys we don't even need macros
>lol this lisp doesn't even have macros
When will they learn?

Nevermind I'm retarded.

Anyone ever have issues when starting a side project but you're also employed?

akari-bbs rev. 12 is now live!
akaribbs.mooo.com/

Now featuring nested code tags!

Does going to college count?

keep up the good work

It does have macros. It doesn't have hygienic macros or define-syntax.

Akari boobs

I think it's more the legality issue I'm worried about. I don't want them to claim the work as theirs if I work on it at home. They say as long as I tell them about it I should be fine?

Where is image capability? It looks cute af desu

Why doesn't it respond when I try to post >">alert()&?

Any vim plugins to add more syntax highlighting for java? I looked but couldn't find any, maybe I am just bad at it. The code highlighting by default is very minimal, and kinda boring to look at.

C# seems more polished than java desu, not that I like c# at all either

>emoji
i'm migrating there

don't work on your side project on company time or using their equipment (computers etc) and don't steal their trade secrets

r8 my sort m80s

any way i can improve it?

pastebin.com/mJ6A7Hj1

This vim command will improve it: ":%d"

C# is beautiful.

Because you're a bad person.

I would disagree, but at least it is rather consistent, and seems to have oneWayToDoThings™ to some extent

for example for eaching over a dictionary/map is rather ugly in java compared to c# iirc, haven't done c# in about 5 months

No im legitimately curious because it correctly escapes my tags but for some combinations it just kills the connection??
You could at least give an error message. What is the server running on?

thats rude. i thought i did a good job.

i dare you to do better.

>developer evangelist

int main (int argc, char** argv) {
int n = argc - 1, i, j;
int array[n];
for (i = 0; i < n; i++)
array[i] = strtol(argv[i+1], NULL, 0);

for (;;) {
i = rand() % n;
j = rand() % n;
array[i] ^= array[j];
array[j] ^= array[i];
array[i] ^= array[j];
for (i = 0; i < n - 1; i++) {
if (array[i] > array[i+1])
goto cont;
}
break;
cont:;
}

for (i = 0; i < n; i++)
printf("%s%d", i ? ", " : "", array[i]);
print("\n");
return 0;
}

lighttpd

I've been trying to figure out why some strings will do that, yet they always manage to post successfully before the cgi dies.
I can't give an error message when i don't know the cause yet.

(define (shifter L) (shiftingString L 1))

(define (shiftingString L counter)
(begin
(display L)
(newline)
(if (< counter (length L))
(shiftingString (cons (last L) (notLast L)) (+ counter 1))
#t)
)
)

(define (notLast L)
(if (null? (cdr L))
'()
(cons (car L) (notLast (cdr L)))
)
)

(define (last L)
(if (null? (cdr L))
(car L)
(last (cdr L))
)
)

>xor swap
>unnecessary goto
This code is gross.

Put those parenthesis back on the same line
Sin
Sin

I was going easy on you
Don't provoke me

Haskell is not really my favorite, and I haven't done much with it besides fucking around with the ghci.

rot x s = drop x s ++ take x s
meme x = zipWith (\a b -> rot a x) ([0..length x + 1]) (x ++ "a")
mapM_ putStrLn (meme "Lolicon")

*unsheathes claymore*
*look at you askew*
If you're going to start anything, go outside. I'll not have my pub destroyed in a brawl again.
*slowly sits back down*

nb m8 you must have been an honors student. needs more threads though

exactly, my sort cant be beat. you'd know that if you werent a drooling tripfag.

*cums*

*evades*
OUT WITH YE! OUT

thanks for playing with me

rot x s = back ++ front
where (front, back) = splitAt x s


using ParallelListComp
meme x = [ rot a x | a

how do i tell gcc to statically link only some libraries? i've googled it a bit and there are conflicting suggestions and it looks complicated. the project i'm working with uses numerous libraries and i want most of them to be dynamically linked, but i want a handful to be statically linked for speed/debugging reasons. how do?

Yeah I am too! Java is good for Android dev user...

Where's the new new problem?

IIRC all the libs specified before the -static flag will be static, until another flag specifies another linking method.

fucking miracles

Uh what? Did you not install GSL correctly?

gsl_sf_hyperg.h should exist if you have it installed.

gnu.org/software/gsl/manual/html_node/Hypergeometric-Functions.html

make a hollow square with your favorite word
LOLICON
O O
L C
I I
C L
O O
NOCILOL

if its too hard for you annon just make a boring hollow square with a width and height of X, with X being a real number
ouput should look like
#####
# #
# #
# #
#####

i feel like ive forgotten how to write

i've got to go to sleep, but i dont think the hollow square is as difficult as it appears. you print the word, then on the next line print the 2nd character, length-2 spaces, and the 2nd to last character, then on the next line the 3rd etc until the last line where you print the word in reverse

I've nearly done it, just having teething troubles with indexes being greater than lengths

It's really simple when you think of it as a function of x and y

Haven't prettied it up

fun n s x y | x == 0 = s !! y
| y == 0 = s !! x
| x == n-1 = s !! (n - y - 1)
| y == n-1 = s !! (n - x - 1)
| otherwise = ' '

square s = [ [ fun n s x y | x

Did not tried, working?
#include
#include

using namespace std;

int main(){
string s="123456789";

for(int j=0;j

#include
#define S "LOLICON"
#define R "OCILOL"
#define M "# #"
int main () {
int i, j;
for (i = 0; S[i]; i++, putchar('\n'))
for (j = 0; S[j]; j++)
if (M[i] == '#' || M[j] == '#')
putchar(S R[i + j]);
else
putchar(' ');
}

Oh, I forgot a concat

u forgot to declare i but its good anonkun

improved

import qualified Data.List as L

fun n s y x | x == 0 = s !! y
| y == 0 = s !! x
| x == n - 1 = s !! (n - y - 1)
| y == n - 1 = s !! (n - x - 1)
| otherwise = ' '

square s = L.intercalate "\n" (ofRange line)
where n = length s
line = ofRange . fun n s
ofRange f = map f [0 .. n - 1]

Revised
#include
#define M "|-----|"
#define S "LOLICONOCILOL"
int main () {
int i, j;
for (i = 0; M[i]; i++,
putchar('\n'))
for (j = 0; M[j]; j++)
putchar((M[i] - '|') * (M[j] - '|')
? ' '
: S[i + j]);
}

loli = 'lolicon'

for idx, i in enumerate(loli):
if idx==0 or idx==len(loli)-1:
print(loli if idx==0 else loli[::-1])
else:
print(*(i+loli[~idx]), sep=' '*(len(loli)-2), end='\n')

Is programming fun?

>all these DFC
dayum

NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO

It's hell. It's probably worse than fighting a war.

it's a ton of fun, only as a hobby

i'm not really in the mood for code golf
#define S "Lolicon"
#define len(p) ((sizeof(p) / sizeof(*p)) - 1)
int main(void)
{
char *str = S S;
unsigned i, j;
for (i = 0; i < len(str) + 1; i++)
{
for (j = 0; j < len(str); j++)
putchar(str[i + j]);
putchar('\n');
}
}

*snore*
printf("Lolicon\n
nLolico\n
onLolic\n
conLoli\n
iconLol\n
liconLo\n
oliconL\n
Lolicon");

What kind of stuff do you do just for fun?

anime

fuck no

it's alright user. you can still do better

I meant like... programming stuff?

Any of you fags into hardware programming?

anything i can think of, not having to be slaved by old people or hipsters and doing things at my own pace is the best

Is there such thing as an algorithm that generates combinations of 2 integers of a sorted list or an always rising int-int function that gives the least difference?

Wew, now I did, and it's giving me "undefined reference to gsl_sf_hyperg_U" errors.
>tfw

wat

projecteuler.net/problem=44
Is there a certain way to generate pairs in order of their absolute difference?

>tfw you get your parser and pretty printer working perfectly in sync

you need to get more insight first since you can't work directly with infinitely many numbers

Let's say I have a reverse tcp shell running and I am connected to someones computer. What could I do. Like are there any good commands to run that can give me any info? I already know how to get wifi name, wifi passwords, users and email usernames. Is there anything else that I can do?

reversible applicative parser functor when

HELLO FRIENDS

Here is what i want to build using Java.

A user inputs 3 cities (single word cities only)

The cities are then printed out one after another in alphabetical order.

i.e. someone types in Mumbai Delhi Bangalore

it should print out:

Bangalore
Delhi
Mumbai

How do I do this my friends?

Here are my thoughts so far:

1)Tokenize the strings
2) ???
3) use some kind of if statement

Any suggestions/guidance?

yeah sure

thank you my friend

I thought there was a way to get user passwords. Let me do my googles real quick

>how do i sort 3 numbers?

1)take input
2)Tokenize the strings
3)sort them
4)print them

teach me my friend

>2)Tokenize the strings
>3)sort them

I need help with these two parts my friend.

Anyone?

in haskell this is just

main = replicateM 3 getLine >>= (traverse putStrLn . sort)

>how do i google

in java my friend

in java please, my friend

Scooby pls come back to /fit/

gno

traverse_*

here's a slightly different program
main = getLine >>= (putStrLn . unwords . sort . words)

>those sample cities

here
shit = ['mumbai','delhi','bangalore']
shit.sort()
print(*shit, sep='\n')

>frogposter

+1 rupee

>Structs need to contain a highly variable amount of rapidly shifting data
>Structs (and the personal data they're pointing to if that's the implementation) are copied millions of times every few seconds so struct size is an issue
>Dynamically allocating/deallocating the data all the time is obviously impractical
What do other than kms?

Scoopy pls i lov u

Lazy hash map

I believe user required it to be in Java, user.

I think i've just changed my mind about the core design of my language's typesystem. is it time to start over?

what's the change

my b, but with that it would be easy enough to translate it into his favorite language, its not too hard to read

I believe you are a brony, Ruby.

In c++ ternary operator is lvalue...

lvalue value or lvalue reference?

normal lvalule meaning:


(a > b ? a : b) = 100;


No one sane would let this past code review but you can do it.

In all fairness, I'm going to guess that this is a school assignment, and that he's probably going to have to not use a built in sort routine. The task should be trivial, and your code would outline that (even if he has to implement sort() himself), but somehow I doubt he is going to find this easy, given that he had to come here at all.

We prefer the term "horsefucker".

ive thought over the idea of type states after seeing some stuff coming out of ICFP. it kinda reminded me of some ideas i had really early on in the design of the language where types could only be explicitly behavioural or non-behavioural. so this means there are no values of a behavioural type and they're defined as such. behavioural types could be dependently typed possibly, without normal types being dependently typed. that would simplify a lot of the type inference rules for me and it would be effectively as good as having full dependent types for my use cases. the important thing is that this allows mutable type states without causing weirdness if you mutate a type that affects the possible range of values. for example, it would make the mutation `Int => Float` impossible because you can't convert an Int to a Float transparently. on the other hand, you can convert a type parameter that's unused. by forcing that type parameter to be a type that's specifically defined as behavioural, you know it won't actually change the possible values of the whole type. this should also make for more sane rules regarding my muted variants and shit like that. im thinking of having like all behavioural types end with ! or something to make it clear. dont have time to write up a full example of some of my ideas right now but ill try some shit later

nice text wall

i didn't think it like that, that might be true

Rolling

Fuck off with this trash every time you faggots

rolling

To whoever posted Mike Acton's lecture yesterday: thank you! I didn't actually consciously make use of what he spoke of but midway through watching it I came upon a brilliant solution to my problem. Cluncky and problem-specific, but brilliant still.

Gimme a decent beginner(to the language, not programming in general) project I can mess around with in D.

Hello World

Does this compile, and if so why and whats the output?

%:include
int main(){
const char* bar[];
std::cout

NEET

That's way too easy

import std.stdio;
void main() { writeln("Hello World"); }


I want something that actually counts as practice....

good! Have Maki!

You've already fucked up user
void main() {
import std.stdio : writeln;
writeln("Hello World");
}


thank you senpai

>Need to make a fuckhuge array
>Only need 8 bits of data per element
Is there any reason not to make it a char array even if I just treat the variables as small unsigned ints?

You could always use short int

Oh shit, so pro

>nooo don't use goto reddit told me it was evil XD
makes code a little harder to follow if misused, but still readable and simple. useful in some situations

>oh btw maek sure you're using exceptions and RAII, reddit said those were great!
a complete clusterfuck, borderline impossible to follow the thread of execution unless you know every piece of code, all the data structures, and the call stack at every point in the program inside and out

Stupid frogposter, go back to readdit

But you must be sure never to use RAII even when useful and make sure to discard it because its not useful in all situations. You must never under no circumstances use a tool where applicable.
Like a pro frog poster

Plenty of undergrads come here to get help with their homework because they are too lazy to read their own books and screw around with programming.

>duuuude why are you comparing tools???!!! wtf hacker news told me I have to pretend everything is equally useful so I can appear above it all and superior to all these plebs arguing about the tools of their trade. dude, le hammer and le screwdriver right? I mean, it's not really in this context, it's more like two different brands of hammers and we're arguing about which one is better -- but how would I know that, I've never used either!!! I am an empty vessel for other people's opinions

What the fuck are you doing posting frogs here?
Does this board look like r9k/pol to you?

IIRC shorts are at least 16 bits long. I don't know whether in practice chars are now also usually 16 bits long so if they are you have a point but in theory they're specified to be at least 8.

Either way is there a downside to using chars like this?

Yes you are right i just checked.
Downside is lack of clarity. I'd rather use stdint for int8_t etc. Its better to be precise with types.

to add to
if you are to cast that char it would make a copy in c++ (not sure about c) so if you want best performance its best to avoid casts

>when you pee but you feel like you still need to pee

are you a wizard

What does it say on that can? Konipota?

yep

>muh nazi frogs

stupid normalfag redditor, leave this site and never return

Google Cloud Vision

Mmk, then what the heck is konipota?

How are you supposed to do gamma correction? The formula I see everywhere is something like:
int correctedColor = 255 * std::pow(colorChannel / 255, 1 / 2.2);
Yet that just gives me 0 on everything.

>Each time an event is resolved a bunch of other events can potentially trigger if their flags are turned on
>Checking the event flags one by one is inefficient since most of them won't be on most of the time
>Using a linked list of activated flags is inefficient because the flags are toggled very frequently
>Efficiency is important since there are real time requirements
Does the following solution sound reasonable? Each event trigger type gets a short. Each trigger type is associated with 4-5 flags, represented by the first 4-5 bits of the variable. When the trigger occurs the variable's value is used as the index of an array of function pointers. Each pointer points to a wrapper function that calls the functions related to each bit in the correct order. Flags are turned on/off via masking.

The only big issue I can think of is all of the wrapper functions fucking the cache. Though they are short this approach means that there are like a hundred of them. The big advantage is that I can avoid actually checking the flags and messing around with dynamic memory/non-continuous pointer-linked memory. Better locality of reference.

>int

I've got no idea i can only read kana i dont understand much.

Gives me 0 on everything with doubles too.

>Cred Forums

float (colorChannel) / 255.0

1.0 / 2.2

I love you, user.

I have a question regarding pointers in C.
If I do the following allocation:
int *ptr = 7;
Now if the pointer doesn't point to any specific address in the memory, will it after my allocation just point to any random cell and give it the value 7?

Also, any idea if I should round the numbers that you get from that result?

it's a pointer with the value 7

yes but you can just add 0.5 before casting to int

How do I make a GUI in C++?

Qt, anything else is a pretty bad experience.

is there a programming language in arabic

Use an external library. Consider SFML or SDL 2.

yes

arabic

Is it necessary to install the whole 32 GB package?

i dont speak arabic though im just wondering

>Qt
>32gb

u wot

if (stmt) return 0;
else return -1;

if (stmt) {
return 0;
} else {
return -1;
}

if (stmt)
{
return 0;
}
else
{
return -1;
}

are structures in c++ basically classes for hipsters`
whats the point of using them over classes?

stmt - 1

You've got it backwards

return stmt ? 0 : -1;

Oh dang, never considered that I could do that if the data has no negative numbers.
If stmt isn't a bool then
return (stmt ? 0 : -1);
otherwise do

Pretty much but there are some differences. In c++ classes are structures with default private access. Also classes if not all members are public, are not guarantied to have same layout in memory like c structs,

why do we even use const types?
to avoid unwanted modifications?

and for the compiler

and general safety, performance also for other people to get better idea what function does or doesnt do.

int number;
while (cardsindeck < 10) {
cin >> number;
if (isdigit(number)) {
you.deckcard(searchforcard(number, game));
++cardsindeck;
}
else {
cout number instead.

...

Try
getLine(cin, number)

instead of cin >> number

Same result, sadly.

Am I wrong or does Zed Shaw come off as a bit of a nut?

const-correct code is far more readable, i hate reading other people's garbage code

can someone post the 100 projects list?

better-dpt-roll.github.io/

nothing

I absolutely know that Java is everywhere and absolutely necessary ...

But learning it makes me feel like a Pajeet ;___; So generic ... replaceable ... the definition of a bargaining codemonkey.

>absolutely necessary
:^)

how do I convert a string into an integer, if std::stoi is not recognized?

Do you really want us to answer this? Solving this problem is instructive for newbies.

use atoi

thanks
I will get going then, I guess

Roll

are they sorted in order of difficulty?

gcc/cc

>if std::stoi is not recognized
If you have an std::string, you should be using std::stoi. If you have a const char*, you should be using strtol.

clang
gcc
pellesc

i need startup ideas.

throw some ideas Cred Forums

A program that recognizes hatespeech and alt-right memes.

I am not even joking, you could sell this to various online platforms. YouTube is already fucking desperate about what to do.

youtube.com/watch?v=Wh_1966vaIA

>A program that recognizes hatespeech
there's already a tool that does this. it was posted on here months ago too.

i need a technology idea for my business class, not memes, user

>A program that recognizes hatespeech
i can create this with two lines of code
regex hatespeech /nigger/, /jew/, /cuck/, /MAGA/;
if ( input(regex_match(hatespeech)) ) {
input.ReportToTheMods;
}

hello i am interested to invest

new thread when ? :3

And thus, nature documentaries about the cuckoo, history articles about ancient Israel, and the entire Phoenix Wright series (due to its use of the "magatama" charm) are all hate speech.

>Youtube Heroes
They're just going to be training machine learning algorithms that will eventually replace them.

last post for dlang

>+300
We need a new thread now !

d a shit

make one dammit

typical programmer mentality

"would be nice if someone made a tool for my particular personal problem :3"

Unless you want to pay for serbian captcha cracking, no more post bots allowed.

I want to compile 64-bit C code with Emacs.

Does this look like the correct file to download?
emacs-25.1-x86_64-w64-mingw32.zip

It has "mingw32" and "w64" which seems like mixed signals.

Is this post too incoherent/undetailed to respond to?

...

...

REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE

I wish I could drive an icepick through your eyesockets

i prefer this one

maybe we should just stay here until this thread dies ...