[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: 316
Thread images: 39

File: daily programming thread2.webm (2MB, 600x338px) Image search: [Google]
daily programming thread2.webm
2MB, 600x338px
old thread: >>56586885

What are you working on, /g/?
>>
Image processor in C++ implementing SSE optimization.
>>
Monads.
>>
File: BillCo.png (25KB, 804x569px) Image search: [Google]
BillCo.png
25KB, 804x569px
Question, How can I improve this? should I include strings? I'm tasked for my assignment to find the amount of profit made after selling the stocks.

My main question is, When I run what I have here, I want to be able to continue the sentence after "stockValue" variable on line 24.

What would be the best way to do that?
>>
>>56590650
goto
>>
File: example.png (22KB, 562x293px) Image search: [Google]
example.png
22KB, 562x293px
>>56590643
You still haven't learned Haskell, have you?
>>
File: akari~~!.gif (1017KB, 471x265px) Image search: [Google]
akari~~!.gif
1017KB, 471x265px
Still working on my C messageboard!
http://akaribbs.mooo.com/

I added blockquotes and post quoting last night.
>>
>>56590650
>What would be the best way to do that?

Remove the newline?
>>
>>56590657
goto? how i'll look it up, I pretty much just want to get rid of line 25.
>>
>>56590658

monoids, endofunctors, applicatives, GADTs.
>>
>>56590650
This is why college sucks for programming.
They spent too long teaching you to write dumb command line calculators.
They don't even teach you about stdin so you end up making stupid assumptions like getc() is for keeping the window open after you're done.
>>
>>56590672
Can you highlight what you're referring to for me?
>>
>>56590650
I bet that someone make your homework...
>>
File: Capture.png (243KB, 1366x739px) Image search: [Google]
Capture.png
243KB, 1366x739px
>>56590613
workin on stuff

>>56590663
why do you spend so much time on this? You aren't actually thinking of making it a real full site right?
>>
>>56590712
Nope, Im trying here! geez, Goto isn't something I've seen yet in the book.
>>
im learning about storage classes
and I don't understand thread storage
what is a thread, and what does it have to do with concurrent programmin

explain using baby words please, since I'm kind of retarded
>>
>>56590695
Do you know what those are or are you just repeating it?
>>
>>56590718
>Can't detect it's meter
>it's
>>
>>56590718
>why do you spend so much time on this?
Because it's fun and I wanted to to try my hand at webdev in the only language I know.
Also, I don't work on it everyday.

>You aren't actually thinking of making it a real full site right?
You don't have ambitions?
>>
>>56590744

I'm just saying buzzwords. The only thing I've learned about haskell is monads. One of these days, I ought to actually learn Memeskell.
>>
>>56590672
Shit man, thanks. it clicked what you're telling me.
>>
File: sublime_text_2016-09-13_21-36-39.png (90KB, 1920x1040px) Image search: [Google]
sublime_text_2016-09-13_21-36-39.png
90KB, 1920x1040px
Let's share our editor color schemes.

I'm currently using the Dracula color scheme (https://github.com/dracula/dracula-theme) with the Oxygen Mono font (https://fonts.google.com/specimen/Oxygen+Mono) in Sublime 3

I'm quite happy with it.
>>
Currently trying to learn C#/Cocoa to start moving out of the command line, and I was wondering why C# handles BOOLs as "unsigned chars" wouldn't it just be easier to keep handling BOOLs as C/C++ boolean variables?
>>
File: light theme.png (7KB, 470x275px) Image search: [Google]
light theme.png
7KB, 470x275px
>>56590803

I must be the only person who prefers light color schemes.
>>
>>56590803
Changed the font and colors a bit, but I use XCode's "Anubis" scheme, which is pretty.
>>
>>56590874

I like bitmap fonts and all, but why have you got the size so high?

Gohu is supposed to be used at 8 point, I think.
>>
>>56590762
A functor (in the context of Haskell, not category theory) is a type constructor (like a generic) providing a function called fmap

A functor lets you lift a regular function (a -> b) into a function on your data type (F a -> F b)
Effectively it replaces all the a's with b's, using a function from a to b
For a container, that will apply the function to all the values.
fmap (+3) [1,2,3] = [4, 5, 6]
-- this is also called <$>
(*7) <$> [3,6,9] = [21, 42, 63]

An applicative is similar, except it knows how to take a datatype containing functions, and combine it with a datatype containing inputs (into a datatype containing results), i.e. F (a -> b) -> F a -> F b
For instance, a ZipList will take a list of functions [(+1), (*2), (/3)] and a list of inputs [3, 7, 1] and apply each input to the respective function
ZipList [(+1), (*2), (/3)] <*> ZipList [3, 4, 5] = ZipList [4, 8, 5/3]
The reason there's a ZipList is because the regular list doesn't do this - the regular list produces all combinations (applies each function to every element, and concatenates the results)

[(+1), (*2), (/3)] <*> [3,4,5] = [3+1,3*2,3/3] ++ [4+1,4*2,4/3] ++ [5+1,5*2,5/3] = [4,6,1,5,8,4/3,6,10,5/3]

It also knows how to put a regular value into the datatype (called "pure")
There are some laws for this that are important in some circumstances, but you don't normally need to know them
For lists, this just gives back a singleton list, pure x = [x]
For ZipLists this gives back an infinite list, pure x = [x,x...]
>>
>>56590895
I really don't know... I guess I don't like having too much negative space on my screen, that and I know that Gohu has two variants (8pt and 11 pt), and I chose the higher one out of a whim
>>
what do you think about making a "programming for dummies" visual language for my senior honors project? doable in 2 semesters?
>>
>>56590847
The screenshot you linked is about Objective-C, not C#, and the question makes no sense for C# (where ints/chars are not implicitly castable to bools)
>>
>>56590762
Monoids are extremely simple.
It's a datatype, with an associative binary operation and an identity type.
Basically, you can combine elements and there's some "empty" element

Binary: a <> b = r

Associative: a <> (b <> c) = (a <> b) <> c
(The parentheses don't matter)

Identity: i <> a = a, a <> i = a
>>
>>56590952
Just write a bunch of #define macros in C and hide them under dummies.h or whatever.
You'll finish your dumb "language" in 20 minutes.
>>
>>56590900

I actually understood this. Thanks. Now when I meme, I can do so with authority.
>>
>>56590953
Wait... (And I fully acknowledge this is full-retard territory) I thought Objective-C and C# were the same thing. I've frequently seen them concurrently in StackOverflow, but that might be me not knowing the difference
>>
>>56590855
I'll def. use a light color scheme if I didn't had eye cobwebs and actually hated my eyes.
>>56590613
A bunch of funtions that will safely allow me to save a .xml, currently it only needs to move the temp file to overwrite the original, and map my object to save it properly.
>>
>>56590988
>I thought Objective-C and C# were the same thing.

Afraid not, chief.
>>
>>56590988
Objective-C and C# are completely different languages (besides both inheriting a lot of syntax and datatype conventions from C).
>>
>>56590650
Place the comments on or above the lines where they are relevant.
>>
I got fired /dpt/, I spent a mere 3 months as an AI developer. How do I write a script that will dispense helium into my lungs?
>>
File: sad 1.png (169KB, 559x350px) Image search: [Google]
sad 1.png
169KB, 559x350px
>>56591007
>>56591001
alright... Reading a SO entry on the difference between them now... Thanks for making the distinction clear, though!
>>
>>56591022
You didn't commented your code right? Those fuckers gonna suffer.
>>
>>56587620
No, because in Javascript
o.m()
is different from
var f = o.m;
f()
.
Within the body of m, `this` will be bound to o in the first, and null in the second.
>>
>>56590663
Nice work!
>>
>>56591044
The one thing I made was already being replaced when I was fired
>>
>>56591026
If you're developing for macOS or iOS, learn Objective-C. If you're developing predominantly for Windows (and to a lesser extent, Linux), learn C#. C# is probably easier to learn by virtue of having Visual Studio.
>>
>>56590663
Code tags and spoiler tags when?
>>
>>56590972
sounds good, i hope you're not implying i should do something more difficult
>>
>>56590663
implement white space preserving for code and some way to way to make an ajax call to receive more up to date posts. Redirecting is kinda lame
>>
>>56590803
anyone know any good bright sublime text skins? All the ones they have are kinda shit
>>
>>56590762
GADTs/generalised algebraic data types

you've got algebraic data types:
data MyPair a = MkPair a a 


on the left is the name of the type (MyPair), the type variables / parameters (a)
on the right are the constructors (MkPair)
the things following a constructor are the parameters to the constructor, "a" is the type variable from earlier, so this
data MyPair a = MkPair a a

translates to this
template <typename a>
struct MyPair {
MyPair(a, a);
a p1,p2;
}


(if the name of the type occurs on the right side, then it's either recursive (for a parameter to the constructor), or the constructor itself is given the same name as the type, e.g.
data MyPair a = MyPair a a
)

Multiple constructors:
data MyCases a = Left' a | Right' a


The constructors are all 1 to 1 - all the information in them is preserved.
A different constructor is a different value of the datatype, e.g.
data Bool = True | False

(these constructors take no parameters)

There is a direct translation of ADTs into an OOP style - each constructor becomes a subtype
--

GADTs adds to this, you can now specify the signature of the constructors:
data MyPair a where
MkPair :: a -> a -> MyPair a
-- MkPair takes an "a", and another "a", and gives back a "MyPair a"
-- the result must always be a MyPair something


but you can also specialise
data MyPair a where
MkPair :: a -> a -> MyPair a
MySpecialPair :: MyPair ()


-- (MyPair a)'s in general are now relatively untouched, but (MyPair ()) has an extra value (MySpecialPair)

If you were creating something like an expression tree, you could for instance require that the first parameter to an "if" branch will produce a boolean result
>>
>>56591139
>A different constructor is a different value of the datatype
Sorry, a different constructor makes a different value
So even if they all take the same parameters, because they're different constructors they make different values.
Or if they take no parameters (like for Bool), then they just are different values.
>>
File: 2016-09-13-220713_648x132_scrot.png (20KB, 648x132px) Image search: [Google]
2016-09-13-220713_648x132_scrot.png
20KB, 648x132px
I've already answered these, I was just wanting to see how my answers compared to /dpt/'s response. This is for concepts of programming languages class.
>>
>>56591139
>putting True before False
I bet you count starting from 1 too, you savage.
>>
>>56591182
I always put the Truth first
>>
>>56591168
1. because it's shit
2. they're both used by people who can't program
3. ruby's a numale language so idk
4. trick question; C is perfect
5. not requiring the user be from a village in india
>>
>>56591168
>Cause Sepples wanna have good features.
>They're used mainly as webdev tools, they differ in that JS can be rendered by the web browser, and PHP is executed in the server.
>The capability to compare not only integers.
>IDK.
>>
>>56591168
>concepts of programming languages
>all examples are pedestrian shit
>>
File: XFJsGS0.jpg (66KB, 1920x1200px) Image search: [Google]
XFJsGS0.jpg
66KB, 1920x1200px
>>56590663
dude that's awesome. Can i get source files somewhere?
I'm learning C
>>
>>56591168
>>56591210
>Forgot the third lmao, ruby operators are treated as objects
>>
>>56591190
Which means you consider Falsity to be greater.
>>
>>56591247
No it doesn't
>>
>>56591126
Not off-hand but this is where I've gotten most of mine so far: http://colorsublime.com/
>>
>>56591255
According to the autoderived instances of Ord and Enum it does. Prelude defines
data Bool = False | True

for a reason.
>>
>>56591303
I didn't autoderive either
I always put the Truth first, regardless of which way I sort
>>
>>56591310
Next you'll tell me that you order your conses before your nils. I shudder to think.
>>
>>56591322
sort = True : sort
>>
>>56591340
That's a pretty cool list of Trues, but why did you call it sort?
>>
>>56591356
It's in order.
>>
>>56590900
>>56590956
>>56591139

This was all pretty informative. Thanks.
>>
False : Prop
False = (A : Prop) => A

True : Prop
True = (A : Prop) => A => A
>>
>>56591302
ah ok thanks
>>
>>56591102
>>56591080
I'm trying to think how I would implement this without trashing the nice modular design I have going.
Spoiler tags are easy, but code tags now means I have to bypass the whitespace filter somehow.

Maybe if I copy all text between
 tags into a separate buffer, overwrite the text with "AAAAA" so the whitespace filter doesn't touch it, and then memcpy it back.

CSS allows you to add scrollbars on overly long divs, right?
>>
>>56591447
I'm trying to think how I would implement this without trashing the nice modular design I have going.
Spoiler tags are easy, but code tags now means I have to bypass the whitespace filter somehow.

Maybe if I copy all text between {code} tags into a separate buffer, overwrite the text with "AAAAA" so the whitespace filter doesn't touch it, and then memcpy it back.

CSS allows you to add scrollbars on overly long divs, right?
>>
>>56591387
With GADTs you can then pattern match on each constructor, bringing any relevant details into scope (normally this just means the values they were constructed with)

data MyPair a = MkPair a a

func (MyPair x y) = x + y


data List a = Null | Cons a (List a)
-- a list is either empty or cons (a head and a tail)

len Null = 0
len (Cons _ t) = 1 + len t

-- _ is a wildcard that basically means that I don't need that particular variable, I could have just said (Cons h t) and not used h


The next thing to learn about Haskell I suppose would be type classes
>>
>>56590977
If you understood that, then you're 80% of the way to Monads.

A Monad is an Applicative functor with one more operation
join :: F (F a) -> F a
.

That's it. That's literally all there is to them. The only other thing is that all these functions have to obey certain rules when you combine them in certain ways.

Here are the instances:
instance Functor [] where
fmap = map
instance Applicative [] where
pure x = [x]
fs <*> xs = [ f x | f <- fs, x <- xs ]
instance Monad [] where
join = concat

instance Functor ZipList where
fmap f (ZipList xs) = ZipList (map f xs)
instance Applicative ZipList where
pure x = ZipList (repeat x)
ZipList fs <*> ZipList xs = ZipList (zipWith ($) fs xs)
-- ZipList is not a Monad, because there's no way
-- to define join that satisfies the Monad laws.


The bind (>>=) operation is just another way to formulate Monads. You can define bind and join in terms of each other.

x >>= k = join (fmap k x)
join xss = xss >>= id
>>
hello dpt.

not really actual programming, but using select case, instead of for individual users, how do i set it to a security group instead?

eg

WshNetwork.RemoveNetworkDrive "J:", True, True
Select Case lcase(WshNetwork.UserName)
Case "barney.fiddledicks","raynard.goldsteinn"
WshNetwork.MapNetworkDrive "J:", "\\server\control point$"
End Select

for individual users, how to do it for a group? Is it just wshnetwork.*groupnamehere*?
>>
File: 1443886213618.jpg (122KB, 1280x720px) Image search: [Google]
1443886213618.jpg
122KB, 1280x720px
>>56591026
>>
>>56591560
Don't forget defining fmap in terms of return and bind:
fmap f = (>>= return . f)
>>
>>56591662
Yes, but we're in a post-FAMP world now, no point in restating the trivial. You could also at least call unit `pure`. `return` was a mistake.
>>
File: count.png (9KB, 725x306px) Image search: [Google]
count.png
9KB, 725x306px
i printed my ABCs
>>
>>56591812

Logisim is neat.
>>
>>56590871
you also don't need the outer while loop.
>>
>>56591574
could you give us some context at least? what lang is this, where is it used, and what for?
>>
functional

programming
>>
>>56592024
""""""""""""""""functional""""""""""""""""
""""""""""""""""programming""""""""""""""""
>>
>>56592024
delet this
>>
File: haskell.png (354KB, 905x460px) Image search: [Google]
haskell.png
354KB, 905x460px
https://soundcloud.com/anton-kho/jungle-etude-2-feat-simon-peyton-jones
>>
File: 1468284417423.gif (2MB, 320x240px) Image search: [Google]
1468284417423.gif
2MB, 320x240px
>>56592024
>>
>>56590613
Give me some programming music. I have some really boring shit to do tonight.
>>
>>56592100
https://www.youtube.com/playlist?list=PLLGk12CjUeW50Xt3-ObW2rqVPZaIG8zio
>>
>>56592100
>>56592078
>>
>>56592100
https://www.youtube.com/watch?v=cVVlMQved8k&index=6&list=LLD5Wsn4RKmDg1O3Qg0as2Lw

I have a collection of 461 songs I like
>>
wait, so all externs are initialized to 0?
>>
>>56592158
>wait
>>
tfw half way through your project you realize you were retarded when designing it but you can't undesign it because it's already live and in use by 10+ people
>>
File: SICP is a meme.png (6KB, 480x278px) Image search: [Google]
SICP is a meme.png
6KB, 480x278px
>>56592083
>>
>>56592169
>tfw you thought a lot about a project that literally no one uses
>>
>>56592200
oh man I know this feeling WAY too well

then again my tools improve my life so not totally worthless
>>
>>56592200
you can always make it open source :/

i'd have to start over from scratch but use the same database or migrate it to a new structure
>>
>>56590718
>Can't detect meter
My Last Duchess looks like it's in iambic pentameter, with some fudging in a few lines.

t. English major
>>
>>56591984
looks like visual basic
>>
>>56592224
>>56592232
as a programmer, I'm eternal noob, and while this project wasn't that big, it still took me a lot of time...
I did open-source it, partly at least (as a library). it's a website that went live a year ago, and got no regular users.
after open-sourcing the lib, someone asked me for a CLI tool... but, since I'm lazy, I didn't make it. I should, though, perhaps that way it would actually help someone.
>>
>>56592292

If it's open source, they can make it. Tell them to stop being lazy.
>>
File: yeeeeah.gif (13KB, 200x200px) Image search: [Google]
yeeeeah.gif
13KB, 200x200px
I want strstr() to return the pointer location of the last occurance of a certain string.

Is it stupid to reverse the haystack and needle and then do something like
char *end = strstr(strrev(string), strrev(tag[1]));
last_occur = &str[len] - end;

last_occur becomes valid as soon as I reverse the haystack string again.
>>
>>56592304
That philosophy only flies when you already have a sufficiently large install base such that users who are turned off to the concept bring no added value (ie. they likely wouldn't have contributed regardless of your response). When you have such a small project that you qualify "used by people" with "10+", the value of getting an additional person using your tools so as to spread word-of-mouth likely outweighs the burden of developing whatever it is they wanted (assuming their request is something reasonable, like a CLI wrapper for methods in the library or something so they can use it immediately, which is what I assume GP meant). Plus, your project starts to build a reputation of being open to suggestions, which makes it more likely the person you gained as a user will recommend your work to others in the future.
>>
>>56592304
I mean, I myself could make lots of multiplatform desktop/phone apps with this lib... but the fact that my website had no regular users really dissapointed me. perhaps I'm a terrible marketer, perhaps the website is just shit, but, as a concept, it could be helpful in other context... perhaps barely anyone cares about this tool
>>
>>56592382
this

>>56592393
or perhaps I'm just really lazy and dumb
>>
>>56592382

NO! You have to rule with an iron fist, lest you get walked all over. It's called the Linus method.
>>
>>56592292
well are you gonna post it or what?!?!
>>
>>56592488
nah, I'll let it die.
it's a shitty wrapper for TTS engines/ffmpeg written in Go.
>>
>>56592548
post it f*ggot
>>
can you guys show me some small things you coded in python?
>>
>>56592625
i made an image scraper for kpop general but it killed my hard drive :/
>>
>>56592639
>kpop general
You are cancer
>>
>>56592639
I meant the source code. Do you still have it archived somewhere?
>>
File: kpop filter.png (13KB, 368x383px) Image search: [Google]
kpop filter.png
13KB, 368x383px
>>56592664
they're a good source of laughs
>>
>>56590613
Writing a compiler for Pascal (or rather a subset of Pascal) using Alex and Happy.
>>
>>56592698
probs

ill have to look i think it might have been on the same hdd lol

>>56592664
i only fapped i didn't post
>>
>>56592348
A way you could do this without modifying the input would be to continuously use strstr until there is nothing left.
#include <stdio.h>
#include <string.h>

char *strrstr(const char *haystack, const char *needle)
{
char *match, *prev = NULL;

while ((match = strstr(haystack, needle)) != NULL) {
prev = match;
haystack = match + 1;
}

return prev;
}

int main()
{
const char *str = "testtesttest";

printf("%s\n", strstr(str, "test"));
printf("%s\n", strrstr(str, "test"));
printf("%p\n", strrstr(str, "abcd"));
}

I think this is pretty shitty for the worst case though.
>>
File: 01.gif (46KB, 600x600px) Image search: [Google]
01.gif
46KB, 600x600px
>>56590613
virtual machine language to compete with java in c++
>>
File: Screenshot_20160914_012640.png (159KB, 1366x768px) Image search: [Google]
Screenshot_20160914_012640.png
159KB, 1366x768px
>>56590803
>>
>>56592625
>>56592639
I too made an image scraper but for the other chan

was nice until they shut down the boards I was interested in

http://pastebin.com/ye7Fvttf
>>
def ftcc():
e = raw_input("please enter a number:")
d = int(e)
c = d - 32
a = c * 5 / 9
print str(e) + " degrees Farenheit is " + str(a) + " degrees Celsius"
def ctfc():
x = raw_input("please enter a number:")
z = int(x)
y = z * 9 / 5
w = y + 32
print str(x) + " degrees Celsius is " + str(w) + " degrees Farenheit"
while 1 == 1:
ch = raw_input("Are you converting from celsius or farenheit? please use only the first letter. i:e: 'f' or 'c': ")
if ch == "f":
ftcc()
elif ch == "c":
ctfc()
else:
print "try again!"

pls rate
I'm terrible but I want to learn
>>
File: Screenshot_2016-09-14_00-29-40.png (2MB, 1919x1079px) Image search: [Google]
Screenshot_2016-09-14_00-29-40.png
2MB, 1919x1079px
>>56590803
>>
>>56592731
kill yourself you fucking faggot
>>
File: hereyougo.gif (88KB, 10000x10000px) Image search: [Google]
hereyougo.gif
88KB, 10000x10000px
>>56592792
What did I do?
>>
>>56592772
- reduce the amount of code, you have some duplicated stuff
- use self-explanatory names for your variables
- use try/except blocks
>>
>>56592772
Give your variables descriptive names. Single letter variable names like this make little sense to a reader.
You don't need that many intermediate variables.
>>
>>56592772
Terrible naming conventions. I should be able to generally know what a method does, and what the contents of a variable are, from just the name. I shouldn't need to read the function definition to learn that "ftcc" converts degrees farenheit to celsius.
>>
>>56592772
>while 1 == 1:
while True:

>>56592802
>- use try/except blocks
for the
>d = int(e)
and
>z = int(x)
parts (which is the duplicated code I'm talking about)
>>
>>56590613
Ive said the same thing for the past week or so, but Im modifying a C library I made, and hopefully getting on to the next part of my project (Java, yay)
>>
>>56592731
This is my colour scheme too. Why u no use fixed width font tho?
>>
>>56590803
hi
>>
>>56592820
I haven't learned about try/except blocks yet. I don't really know what they are.
>>
>>56592780
why are D fags all so edgy? I feel like you can't write D without listening to heavy metal or EDM
>>
>>56592852
>nano
>Dense as fuck (i.e. no empty lines to break things up)
>goto immediately to return statement
>sizeof(char)
>casting void pointers
>obvious comments
>>
>>56592772
I redid it for you OK

def to_celsius():

degree_input = input("Please enter a number:")

tmp_converted = int(degree_input) - 32
converted = tmp_converted * 5 / 9
print (str(converted) + " degrees Farenheit is " + str(degree_input) + " degrees Celsius")

def to_fahrenheit():

degree_input = input("Please enter a number:")

tmp_converted = int(degree_input) * 9 / 5
converted = tmp_converted + 32
print (str(converted) + " degrees Celsius is " + str(degree_input) + " degrees Farenheit")


stop=False

while stop == False:

user_input = input("Type F for Farenheit, C for Celsius, or Exit to Exit. ").lower()

if user_input == "f":
to_celsius()

elif user_input == "c":
to_fahrenheit()

elif user_input == "exit":
stop=True

else:
print ("Try Again!")

print()
>>
>>56592838
Ehh, doesn't appeal to me
>>
>>56592698
found it in the newspaper

import json
import requests
import shutil
import os.path
import sqlite3
import time
import re
import sys

board = "mu"
while True:
conn = sqlite3.connect("images.db")
c = conn.cursor()

r = requests.get("https://a.4cdn.org/mu/catalog.json")

if r.status_code == 200:
j = json.loads(r.text)

for page in j:
for thread in page["threads"]:
try:
if ("kpo" or "kpg") in thread["sub"].lower():
#print(thread["no"])
a = "https://a.4cdn.org/mu/thread/" + str(thread["no"]) + ".json"
print(a)
t = requests.get(a)
th = json.loads(t.text)
for posts in th["posts"]:
if "tim" in posts:
temp = str(posts["tim"]) + posts["ext"] + " " + posts["md5"] + " " + posts["filename"]
#print("Saving " + str(posts["tim"]) + posts["ext"])
print("Saving " + str(posts["tim"]) + posts["ext"])

test = "https://i.4cdn.org/mu/" + str(posts["tim"]) + posts["ext"]
print(test)

#count = c.execute("SELECT count(1) FROM images")
fname = re.sub('[\?\*:"/\\|<>]','_',posts["filename"])
if os.path.isfile(fname + posts["ext"]):
fname = str(posts["tim"])
try:
c.execute("INSERT INTO images VALUES('" + str(posts["tim"]) + "','" + fname+posts["ext"] + "','" + posts["md5"] + "');")
except Exception as e:
print(e)
print("not saving it")
continue

resp = requests.get(test, stream=True)
if resp.status_code == 200:

with open(fname + posts["ext"], 'wb') as out_file:
shutil.copyfileobj(resp.raw, out_file)
#conn.commit()
print("saved")
else:
c.execute("DELETE FROM images WHERE image_id='" + str(posts["tim"]) +"';")
print("can't save")

# print(posts)
#print(t.text)
except KeyError:
continue
else:
continue

conn.commit()
c.close()
time.sleep(60)
>>
>>56592910
>No indentation
Good one, snekfag.
>>
>>56592919
i lost the hdd that had it on and managed to find it in the archive
https://warosu.org/g/thread/S49645206#p49645343
>>
>>56592927
Your dumb program is meaningless without indentation.
>>
>>56592940
https://archive.rebeccablacktech.com/g/thread/S49645206#p49645343

here it has indentation

cant post it cause they replaced \t with 4 spaces
>>
was doing FreeCodeCamp but in the middle of it I suddenly realized I hate web dev

Now I'm learning Java with the Finland University online course

I'm enjoying it, much less gay than web shit
>>
>>56592952
Java is still pretty gay.
>>
>>56592866
aha. well, try giving your program some non-numeric input... then read the error message you get.
don't hurry, though, you will learn. take that as a motivator :)
>>
i think i remember it wasn't the latest version tho

i fixed the bugging out and could enter in any board/search to scrape
>>
>>56592960
I guess you're one of those C purists.
Java is still nr.1
>>
>>56592895
>nano
yes
>Dense as fuck (i.e. no empty lines to break things up)
that's what the comments are for
>goto immediately to return statement
that's what goto is for
>sizeof(char)
yes?
>casting void pointers
literally what is wrong with this?
>obvious comments
not really
>>
File: 2037619.jpg (335KB, 640x610px) Image search: [Google]
2037619.jpg
335KB, 640x610px
>>56590613
Why is it that my OpenSSL session is still accepted even though I haven't specified a certificate directory with
SSL_CTX_load_verify_locations()
?
Wouldn't that mean my connection is not secure?
>>
>>56592100
https://www.youtube.com/watch?v=SFLw8aH-M2w
>>
>>56592992
>>nano
>yes
Why don't you use a text editor which actually has some features?
>that's what the comments are for
They still contribute to the "density". Adding a blank line between sections of code which are logically different makes things much nicer to read.
>that's what goto is for
Just return immediately.
>>sizeof(char)
>yes?
It's guaranteed to be 1. Using it is pointless.
>literally what is wrong with this?
In C, void pointers are automatically converted to other pointers. There is absolutely no reason to cast and all it does is repeat information.
>not really
A lot of your comments are explaining 'what' you're doing. You can clearly see that from the code itself. These kinds of comments are pointless.
Comments should explain 'why' you're doing something and give a much more high-level explanation of what's going on.
>>
>>56593036
I could go way harder with the comments, if that's what you're trying to say.
How about something like
/* dynamically allocating a string of k + 1 bytes to use as the extract buffer :333333 */
>>
>>56593058
>:333333
triggered
>>
>>56592879
I listen to neither my dude
>>
>>56592802
>>56592809
>>56592812
>>56592820
I think I cleaned it up a little bit with your advice
def convertFarenheitToCelsius():
farenheitToConvert = raw_input("please enter a number:")
convertedToCelsius = (int(farenheitToConvert) - 32) * 5 / 9
print str(farenheitToConvert) + " degrees Farenheit is " + str(convertedToCelsius) + " degrees Celsius"
def convertCelsiusToFarenheit():
celsiusToConvert = raw_input("please enter a number:")
convertedToFarenheit = int(celsiusToConvert) * 9 / 5 + 32
print str(celsiusToConvert) + " degrees Celsius is " + str(convertedToFarenheit) + " degrees Farenheit"
while True:
ch = raw_input("Are you converting from celsius or farenheit? please use only the first letter. i:e: 'f' or 'c', or type 'exit' to exit:")
if ch == "f":
convertFarenheitToCelsius()
elif ch == "c":
convertCelsiusToFarenheit()
elif ch == "exit":
break
else:
print "try again!"

>>56592896
thank you but I must learn for myself.
>>
>>56593239
You've gone too far the opposite direction.
Those variable names are too long and unwieldy.
>>
>>56593250
ok thank you I will work on shortening them
>>
>>56593239
uh ok lol I didn't even change anything but readability

I put in spacing, sensible names, removed the while (True) which is very bad practice, and converted your input to lower case to control for upper or lower case but all of them seem to have been lost on you
>>
>>56592984
Morons are nr. 1, yeah.
>>
Are there any more advanced communities to get programming help from, besides stackoverflow?
I've come to a point where my problems are not google-able and /g/ can't help me.
>>
>>56593281
y'see, I'm what one would call stupid
>>
Hey guys kinda a total newfag here, kinda confused with non-standard libraries. How do i include them? do I have to put them in the project's directory or is there a folder the IDE uses to store libraries for calling up whenever?

using codeblocks on windows if that makes any difference
>>
Any recommended books for math-deficient brainlet like me? Anything beyond simple algebra is hard for me.
>>
>>56593408
Basic Mathematics by Serge Lang

Buy/Pirate this book (he's dead). It's highschool math, from the perspective of a Mathematician. You will learn up Pre-Calculus and be prepared for rigorous proofs later.

An Introduction to Mathematical Reasoning" by Peter J Eccels

This changes you from rote drilling and being a human calculator in highschool to learning what math actually is, and what proofs do. Excellent, excellent book.

How to Solve It by G. Polya

How to do proofs, written in 1940s and still for sale in every Chapters/B&N bookstore to this day because it's the best proof helper that exists.
>>
>>56593373
just use linux m8
>>
>>56593450
I also recommend lang and polya.
Though how to solve it didn't really go into proofs, just heuristic, which is important for proofs, but there's also a book called "how to prove it" which centers around proofs.
>>
>>56593465
>tfw I only like to run linux in sandbox for development
>but my ram and cpu is all bottlenecked

gotta upgrade my computer to compile anything bigger than a roguelike in less than ten minutes in sandbox though :^(
>>
>>56593250
I think I'm beginning to strike the balance
def FarenheitToCelsius():

Farenheit = raw_input("please enter a number:")
convertedF = (int(Farenheit) - 32) * 5 / 9
print str(Farenheit) + " degrees Farenheit is " + str(convertedF) + " degrees Celsius"

def CelsiusToFarenheit():

Celsius = raw_input("please enter a number:")
convertedC = int(Celsius) * 9 / 5 + 32
print str(Celsius) + " degrees Celsius is " + str(convertedC) + " degrees Farenheit"

while True:
input = raw_input("Are you converting from celsius or farenheit? please use only the first letter. i:e: 'f' or 'c', or type 'exit' to exit:")
if input == "f":
FarenheitToCelsius()
elif input == "c":
CelsiusToFarenheit()
elif input == "exit":
break
else:
print "try again!"

>>56593281
also, why is while true very bad practice? I mean, I realize that its technically an infinite loop, so I added a break.
>>
can any of those programming competition websites actually land you a job?
>>
>>56593524
>why is while true very bad practice?
Because it "hides" the breaking condition. Also, imagine that same condition breaks.
>>
>>56593581
yes

/dpt/ isn't programmers though mostly larpers in CS class
>>
>>56593585
well, which one(s)?
some monts ago, I got relatively good ratings easily in one site (can't even remember which one), simply because I used Go and C for my solutions, which are very performant and use the least memory :^)
>>
>>56593524
it just 'is' bad practice and against readability, just like capitalizing variable or def names or not indenting

You will hopefully never see it in another programmer's code

only capitalize class names too, your variables can be named like celciusToFahrenheit or celcius_to_fahrenheit based on your preference but CelciusToFahrenheit is considered bad form (and no one else uses it if you look at the other snippets in this thread)
>>
File: g_ct.jpg (50KB, 823x335px) Image search: [Google]
g_ct.jpg
50KB, 823x335px
>>56590803
Here ya go
>>
File: 1468451314096.jpg (59KB, 500x667px) Image search: [Google]
1468451314096.jpg
59KB, 500x667px
>>56593618
Ok i didn't know any of that about capitalization or about setting a loops value directly as True.
Right now i know nothing, but with your help I will one day spread my wings and become a mighty pajeet
>>
>>56591168
1. """Retro-compatibility""" or so they say. It was basically their selling point but today with the new revisions of both languages, it's just not true anymore
2. The guy who wrote this question probably expects something like "JS is used as the front end of a web application while PHP is used in the backend", which is not even a half truth today.
3. Dunno I don't use this shit
4. Case fallthrough
5. Generics
>>
im trying to get into app development coding for apple, is there anyway around having to get an apple boot on my computer to use xcode?

Ive used vmware but the resolution doesnt update and it looks like cock.
>>
Should I stick to Notepad++ as a noobie?
>>
>>56594069
No use Vim.
>>
>>56594069
it literally doesn't matter
>>
>>56594254
As long as you are using Vim.
>>
File: 1452736689995.png (17KB, 561x332px) Image search: [Google]
1452736689995.png
17KB, 561x332px
How would I fast-forward master to D?

Would
git checkout master
git merge D

do it?
>>
File: 1456692023699s.jpg (4KB, 123x125px) Image search: [Google]
1456692023699s.jpg
4KB, 123x125px
>He doesn't listen to the soundtrack of his favorite cyberpunk video game while programming
>>
File: fhex3.webm (806KB, 736x412px) Image search: [Google]
fhex3.webm
806KB, 736x412px
Added an undo function to my hex editor.
>>
I'm trying to do some webshit but,
The website I need to get POST data from redirects the page after it's sent..
I usually capture it with firefox's networking tab but..
Whenever it loads the new page all of the previous data is cleared.
Any ideas?
>>
>>56594519
Is it better than hexedit? what language? link to repo?
I'd use it.
>>
Why do some functions cause a WPF window to not launch, but not give any errors?
>>
>>56594612
maybe you're launching the window off the main thread?
>>
Does term "clean code" even exist in Python? Anybody knows of any books equivalent to Java's "Clean code" for Python?
>>
I have learned something interesting... Safety Net - the tool used by Android Pay and now Pokemon Go - checks root simply by checking of su is in Android's $PATH. I'm thinking if I write a couple of cheap Bash scripts, I may be able to skirt around this tool without having to flash a ROM that doesn't have root baked into the damn thing. Just move su to somewhere on /storage/sdcard/0 temporarily when I want to use Pokemon Go, and copy it back to /system/bin and /system/xbin when not in use!

(and here I thought I might not get a chance to need a bash script on my phone)
>>
>python
4chan scraper thing,
I didn't really want to /download/ things but that functionality can easily be built in and have a lot of options like download threads with x in them or filenames, whatever.

It tries to get all of the facebook and flicr images and sauce them and it counts the image.jpg and tumblr filenames.. What else can I track?
v1: http://pastebin.com/6aD8iBZx
v2: http://pastebin.com/WNDt8NUc
I always feel like threading is a clusterfuck.
Did I do good with any of this?
What should I add? Suggestions?
>>
>>56594544
>Is it better than hexedit?
It really lacks functionality at the moment (saving changed seems somewhat important). In the case that I won't get bored of it, it might get better than hexedit (I can't believe you can't move with the home-row keys in hexedit, seems like a waste).

>what language?
C with ncurses

>link to repo?
Don't have an online repo. This is my first ncurses project and it's messy. As I learn more and more of how to use the library I might have to drastically restructure my program. At the end I might upload it somewhere if I'm pleased with the code quality.

>I'd use it.
Thanks, I appreciate that.
>>
>>56594658
Oh, and I had to do some stupid shit because IDLE kills it's self with unicode characters..
Not sure how to fix that.
>stop using IDLE
>>
How powerful are haskell, assembly , prolog and ruby

can I write viruses and stuff with them?
>>
>>56594740
very
yes
>>
>>56594619
Nah, not that. It's only if I include a certain function. I've had problems with this before when a for loop went out of bounds in my code, the WPF window didn't launch but gave no errors. Maybe something similar?
>>
>>56594752
running it in debug mode?
>>
>>56594633
bump
>>
>>56594768
Nah, but I figured out what went wrong. I was calling non-existent rows from a datatable.
>>
>>56594793
should still throw an exception?
>>
>>56594804
Yeah, that's what I should have thought. It wasn't doing it for my for loop OOB either, which it usually would, Might have to check my VS settings.
>>
>>56594223
why vim
>>
Just implemented & and unary * in my C compiler. Only ~80 LOC in the frontend (mainly adding support for pointer types in my representation of the C type system) since I already did work on pointers in the backend when I implemented structs.
>>
>>56595094
Source?
>>
>>56595129
I haven't uploaded it anywhere yet. Honestly the main reason is that I can't think of a decent name... once I do it'll be on GitHub.
>>
>>56595163
Please keep us updated anon-dono
>>
>>56595163
I recommend a name that includes C in it
like Compiler
>>
s.h
int cuck;

void nig(void);


s.c

#include <stdio.h>
#include <s.h>

int main () {
extern int cuck;
printf("%d\n", cuck=9);
return 0;
}

void nig(void) {
puts("you're a nigger");
}


$ cc s.c
s.c:2:15: fatal error: s.h: No such file or directory
#include <s.h>


????
>>
>>56595235
#include "s.h" for paths you specify
<> has the compiler search in header directories
>>
>>56595235
why do you have to declare that cuck is an integer?

I like how in python you can just write "cuck = 7" and it automatically knows you're making cuck into an integer value of 7 without implicitly saying "it's an integer"
>>
>>56595267
static typing
>>
>>56595235
>Ano

#include <s.h> - > #include "s.h"
cc s.h s.c
>>
>>56595267
But it doesn't know it's an integer until runtime. That's the problem.
>>
what do I do if I want to write:
>games
>in two dimensions
>with pixelshit graphics
>that run on an emulator for a classic handheld
should I be looking on /v/ or /vg/?
>>
>>56595267
What if you type "cuck = "loser"" in some other part of the program? Static typing throws you an error in IDE or at compiling while dynamic usually stays silent and does something stupid at runtime.
>>
>>56595306
vg has emugen which could have some more helpful people and vg also has agdg for game dev but it probably has few people working on games for handheld devices
>>
>>56595306
Dont ask advice from 4chan, nobody here knows anything about that. Learn assembly for your target device and browse homebrew communities for help.
>>
>>56595306
go to >>>/vg/agd
>>
>>56595235
j.c
#include "s.h"

_Bool pepe(int dubs) {
return dubs % 11;
}


extern int cuck;
+printf("%d\n", pepe(99));


$ cc j.c s.c
$ ls *.o
]$ ls *o
ls: cannot access '*o': No such file or directory


????
>>
>>56595384
cc likely outputs a file named a.out or a.exe
>>
>>56595398
what about object files
im not talking binaries
>>
>>56595313
Is it healthy to turn an integer variable into a string like you're suggesting? Why would you ever want to do that?
>>
>>56595446
No. You wouldn't.
>>
>>56595445
cc -c j.c # produces j.o

cc -c s.c # produces s.o

cc -o result_executable_binary j.o s.c


you can also do
cc -o j.o j.c
and such
>>
>>56590613
Is this show any good? I want to watch it because I like cute traps but I heard that it's not that good
>>
>>56595486
>>56595445
accidentally used s.c instead of s.o in the third
>>
What's the best way to get really good at programming (mainly C++). Obviously the answer is to program more but I wanna know more specifically

Is there a list of projects I should try out. Maybe a site with challenges or something?
>>
>>56595504
short answer: yes
long answer: no, because compilers linking objects together just know the function name, type, and arguments and can't optimize functions calls completely compared to compiling all the source files together

realistic answer: it doesn't matter, just do whatever is best for the project (objects can prevent unchanged files from being recompiled which could speed on compile times on big big projects)
>>
File: 1438776631021.png (305KB, 1920x1080px) Image search: [Google]
1438776631021.png
305KB, 1920x1080px
>>56595546
images like pic related are posted occasionally

time mostly helps with getting better though

some things you should bookmark for the eventual impossible to find bug:
http://en.cppreference.com/w/cpp/language/operator_precedence
https://stackoverflow.com/questions/1143262/what-is-the-difference-between-const-int-const-int-const-and-int-const
>>
>>56595546
>What's the best way to get really good at programming
An entry level sysadmin job at a small company.

Started off just doing little scripts and whatnot to accomplish sysadmin jobs, moved into self-devving full GUI applications working with APIs and databases that the entire company now uses.

I think part of what makes it such a good opportunity to learn is all of the little trial-by-fire moments where you've just got to figure it out and write a solution before the client/tech gets pissed.
>>
>>56590847
>true/yes has to be 1
Ok. So why did they make it that way?
I'd stop reading right there.
>>
File: anal beads.png (44KB, 829x337px) Image search: [Google]
anal beads.png
44KB, 829x337px
>>
>>56591168
1. I don't know. Stroustrop is a fucking retard and was always a fucking retard.
2. They both frequently handle web related stuff. What do you mean explain? PHP is used on the server side (usually) and Javascript is used clientside (usually).
3. Why are we learning about an arbitrary set of languages instead of learning how to become good programmers?
4. There's no deficiencies of C's Switch statement. Only bad users.
5. OOP? That's probably what you're looking for you fuckhead. Go ahead fail me. It'd be a badge of merit to fail this course.
>>
>>56595913
>There's no deficiencies of C's Switch statement.
;^)
>>
>>56595942
Suspect this is a bad user..
>>
>>56595883
>ask any lawyer
Any decent lawyer should complain about the political process of writing laws rather than the language. A law is usually determined by 'intent' so you make some historical judgement.

But why not codify that? Why not have the person write down the intent (such as moral motivation for the law) along with the law to make it perfectly fucking clear what they mean and have that be part of law? Then every case could be judged based on the law alone rather than how its been used in practice which is just as arbitrary you're just going by a second hand source that doesn't know what the fuck they're on about.

English is very verbose though.
>>
>>56595913
>>56595942
>>56595954
Doesn't c# have some build-in hash-table magic when using switch with a string or something?
At least that's what I heard.
>>
Let's say that you have the following C++ classes:

class A {...} 
class B {...}
class C : B {...}
class D : B {...}

class E : A {...}

C and D both contain a pointer to A. Now, I want to create an instance of both C and D in A.

If I declare these classes in the header as B*, and simply let the .cpp file create the C and D objects, I avoid the nasty circular dependencies which I couldn't solve even with forward declarations. However, when I try to access the members of A from its subclass E, this->a recognizes a as B* and not C*/D* and thus won't compile when trying to access the subclasses' methods.

What I'm wondering is
1) Is it the correct thing to do, to define the member variables as a base class pointer?
2) How do I access the methods of C and D from E?
>>
File: (C# Reference).png (25KB, 882x307px) Image search: [Google]
(C# Reference).png
25KB, 882x307px
>>56595994
>What arbitrary constraint does C# put on C's most prominent abstraction for jump statements that disallows such convenient use?
>>
>>56595994
There's a threshold somewhere around 6-10 entries that makes the behavior either a sequential IF (small quantity of entries), or a HashTable (if it's predicted to be more efficient).

Obviously, the overhead of generating the hash table is not efficient for a tiny amount of cases.

t. Jon Skeet
>>
>>56596037
that's lame
>>
I started playing around with haskell 30 min ago, its not bad at all. It took a bit of work to setup vim properly and add all build commands but it works nice and i get types on the fly. I actually like it and cabal is pretty nice.
>>
>>56596037
I can understand why this could cause problems for unobservant programmers, but it is a bit silly that fall-through isn't supported.

From a performance standpoint, wouldn't that force the potentially generated hash table to be sequential, and thus force an additional sort?

The machine would have to know not only the associations between case and action, but also between subsequent cases.
>>
Why do people still write Batch scripts when Powershell exists?
>>
>>56596204
Because powershell is
1: non-standard (not sh compatible)
2: nobody uses it
3: it was not free software
4: it is a pain to compile
5: .net lol
>>
>>56596180
>wouldn't that force the potentially generated hash table to be sequential
What? Hash tables are inherently unordered.
>>
>>56596230
>it was not free software
>judging a technology on its previous form

Nigga, your dick was like a centimeter long at one point, but I don't think anyone brings that up.
>>
>>56596268
>>it was not free software
>>judging a technology on its previous form
I am not judging anything, I am simply saying why people do not prefer it.
>>
>>56596256
Well, I know, but the point is that if you allow fall-through like that, you have to store the values in a sequential data type with lookup, assuming there are enough switches.
>>
>>56594740
I don't think you need Prolog. Haskell's Logic monad is as easy to use as Prolog.
>>
>>56596301
Did you mistype or something? In your post you say it's silly that fallthrough *isn't* supported, because it forces it to be sequential.

Also it doesn't have to be stored sequentially, you just need a jump at the end of one block to the beginning of the next. I don't know how it's implemented in C# though, you could take a look at the IL if you're curious.
>>
>>56596016
>C and D both contain a pointer to A. Now, I want to create an instance of both C and D in A.
No, they do not. They contain an instance of A, which contains an instance of D which contains and instance of A which contains an instance of D and so on. Which doesn't compile for obvious reasons.
>Now I want to create an instance of both C and D in A
You're never gonna have that work if you're inheriting.
You're forcing yourself to deal with the woes of OOP though. So OOP is very poorly suited to this (just like any task really but more so here than anywhere else).
Also you should phrase it as
"C and D both contain a pointer to the type A".
The other way of phrasing it would imply you've instantiated objects with the identifiers C, D and A.
>if I declare these classes in the header as B*
Well that's not doing what you did before. There's no circular dependency because B doesn't inherit A, C & D doesn't either.

>1) Is it the correct thing to do, to define the member variables as a base class pointer?
It all depends on what you wish to achiveve.
The idea of inheritance in OOP is often to spare you redefining methods for subclasses. So if A has a foo() function you don't have to write that again for C or D. C and D contain all the members of A so foo() can work on C or D aswell as A.
>How do i access the methods of C and D from E
Well you can't. Draw this up as a tree and see that they're all entirely seperate.

I think you need to understand Object programming better. It's a horrible paradigm, but I'm assuming you're in school and have to learn this stuff.
https://www.youtube.com/watch?v=lbXsrHGhBAU
Is a rather short introduction to OOP which can be helpful. After 26:00 it no longer applies to C++.
Also take this with you:
https://www.youtube.com/watch?v=QM1iUe6IofM
It's more for experienced programmers. But at least keep the title in mind.
>>
GAS ALL THE HASKELL TRANSVESTITES.
>>
>>56596016
>>56596372
Oh and to make things a bit clearer. Your code example gives you:
A can call the methods of A.
B can call the methods of B.
C and call the methods of C and B
D and call the methods of D and B
E and call the methods of E and A
You only have a single step of inheritance here.
If you wanted deeper inheritance you could write.
class A {...} 
class B : A {...}
class C : B {...}

For instance.
Now:
A can call the methods of A.
B can call the methods of A & B.
C can call the methods of A & B & C.

C contains all the members of B and its own members.
B contains all the members of A and its own members
A contains its own members.

This is all basic stuff but i'm just putting it out there because you don't seem to know wtf you're doing desu.
>>
>>56596429
>C contains all the members of B and its own members.
Oh and to be clear.
This means that C contains the members of A too. Since B contains the members of A.
>>
>>56596230

>non-standard
It is just as standard on Windows as Batch is. Moreover, Batch is not sh compatible either -- not by a long shot.

>nobody uses it
Nobody in their right mind uses Batch. Most Windows system administrators use Powershell. Yet these days, I still see newfags writing .bat files for non-trivial programs.

>it was not free software
cmd.exe is still not free software. There's a free implementation, but nobody uses it on Window.

>it is a pain to compile
Powershell is not a compiled language.

>.net lol
.NET is part of what makes Powershell good. Rather than relying on external programs, you can take advantage of the standard library to get a lot of your string and array processing done out of the box. Moreover, if your script needs to do anything convoluted, you can easily just load a DLL compiled in C# or F# for things like, oh I don't know, graphics.
>>
>>56590803
Language?
>>
>>56596474
I thought you said bash, not batch. Oops
>>
>>56596474
>Powershell is not a compiled language.
And I did not say that it is. I said that Powershell by itself is a pain to compile.

Anyhow, there is no such thing as a "compiled language".
>>
Guys how do I learn assembly
>>
>>56596500
depends on what you define as "compiled" and "language"
>>
I made a shitty script program in Java, and now I'm trying to make it's GUI with Swing.
I want to run a method A (which scans a website and puts some data in a json file), and show some strings (generated by A) in a panel while A is running.
I can achieve this by keep sending the strings to the panel and revalidate and repaint it. This doesn't sound like a good approach.

I think running two threads at the same time would be better, thread1 runs the method A and thread2 clears the panel and retrieves the strings and puts them in the panel, every second or so.

Is there a better way to do this?
>>
>>56596515
https://www.youtube.com/watch?v=AGZ_9haluVs&list=PLBFA950BA47F46E86
No joke it's pretty good and does really start from the start.
>>
>>56596548
Have a place where you place the strings, seperate from the GUI entirely.
Have thread 1 update it. Have thread 2 draw the GUI based on that information.

You don't really have to worry about thread syncing because the GUI doesn't modify the data. You can just let it all run asynchronously.

It's a good idea to keep your code that actually does stuff away from the GUI. And that's a fairly good way of doing it.
>>
>>56596490

That would explain it. Honestly, I would see no problem with people writing Bash scripts more on Windows, but if one does not wish to use Bash for whatever reason, one should at the very least use Powershell instead of Batch. Batch is a god-awful language that should absolutely not be used anymore except when maintaining really, REALLY legacy systems where no better alternatives exist.

>>56596500

>I said that Powershell by itself is a pain to compile

Oh. As in it's a bitch to build? I will agree with that sentiment... and in fact, that all of the CoreCLR is a pain in the ass to build, and to integrate into anything. I'm particularly not a fan of Microsoft's current setup with the "dotnet" build utilities that rely on a project.json file and all that. I'd honestly just like corerun and csc installed to somewhere in my $PATH (like Microsoft currently does with Powershell), and to be allowed to use my own choice of build systems.
>>
Can someone recommend an editor where I won't have to use my fucking mouse where I can let the code flow freely from the keyboard without distractions?
>>
>>56596621
textbook definition of vim
>>
>>56596618
>That would explain it. Honestly, I would see no problem with people writing Bash scripts more on Windows, but if one does not wish to use Bash for whatever reason, one should at the very least use Powershell instead of Batch. Batch is a god-awful language that should absolutely not be used anymore except when maintaining really, REALLY legacy systems where no better alternatives exist.
Batch should have never existed in the first place, honestly. It has done more harm than good.
>>
>>56596621
One of the autist editors for linux. Emacs or Vim for example.
>>
>>56596621
emacs, vim, most editors
I recommend the 4coder project but it's not released yet so..
>>
>>56596621
Emacs, the best option.
>>
>>56594069
install gentoo
>>
File: Screenshot_2016-09-14-09-14-33.png (84KB, 1080x1920px) Image search: [Google]
Screenshot_2016-09-14-09-14-33.png
84KB, 1080x1920px
>>56592799
Why folens
>>
Reddit stole our memes again
https://www.reddit.com/r/ProgrammerHumor/comments/52ifal/xpost_from_ranime_irl_probably_the_strangest/
>>
>>56596643

Yes, well, that's Microsoft for you. "Hmm... this Unix thing seems to just work. Let's build something completely different and make it difficult to port software between the two platforms so we can attempt to force people to use our own!"
>>
>>56596729
If batch was at least half good or had any feature at all that was missing from sh I would understand. However it does not, it's literally shit.
Any experienced programmer could make something much better than batch in half a day.
>>
what do you guys think about making a bunch of mathematical functions in scheme, and then loading the file and using scheme as a calculator?
>>
>>56596790
You could also use something more fully featured like wolfram alpha.
>>
>>56596790
This is what I have been doing.
>>
>>56596729
Ballmer's Microsoft*
>>
>>56596807
nonfree trash
>>
>>56596542
Compiled language is a language that you can compile using a compiler.
>>
File: 3141a.png (46KB, 730x543px) Image search: [Google]
3141a.png
46KB, 730x543px
>>56596807
triggered
>>
>>56596842
So, every language in the world?
>>
>>56596882
"no"
>>
File: Wolfram_Alpha.png (26KB, 676x813px) Image search: [Google]
Wolfram_Alpha.png
26KB, 676x813px
>>56596866
Ok?
>>
>>56596895
How so?
>>
>>56596902
You can't compile C++.
>>
>>56596752
>>56596833

Only thing they did right was the PE file format, which was at the very least an okay competitor to ELF. Too bad they made DLLs on Windows a clusterfuck.
>>
File: 1461352698843.png (16KB, 661x318px) Image search: [Google]
1461352698843.png
16KB, 661x318px
>>56596897
kys?
>>
>>56596927
>being ambiguous
It's a computational knowledge engine, not a calculator.
>>
>>56596897
it's still not interpreting it as prefix notation, it's interpreting the space as a multiplication.

kys
>>
>>56596941
did i say i wanted to use scheme to build a computational knowledge engine? math isn't ambiguous
>>
>>56596945
>kys
kys
>>
>>56596912
kek
>>
>>56591203
>>56591210
that should be what the interaction is between PHP and Javascript. Although Javascript has become more server-side with Node.JS. I'll try both answers
>>56591229
fuck I forgot Ruby has arithmetic in the form of classes
>>56595913
its pretty much a class for comparing programming languages like comparing tools for a job. I may post next weeks questions again for some more thoughts from /dpt/.
>>
>>56596912

Just because there are an infinite number of valid C++ programs that cannot be compiled does not mean that the vast majority of valid C++ programs that will ever be made by humans are not able to be compiled.

>>56591168

1. Backwards compatibility, ability to be used as a systems language.
2. Both are webshit. Both have an == operator so horrible that === must be used. Both are dynamically, weakly typed languages.
3. They're just methods on objects. They can also be overridden.
4. C# can switch on strings. C can't.
5. Fuck if I know.
>>
>>56597338
>C# can switch on strings. C can't.
C can switch on strings.

It just looks like a series of else if statements.
>>
Rate babbies first quine

import Text.Printf;main = printf s (show s);s = "import Text.Printf;main = printf s (show s);s = %s"
>>
File: gentoo.png (219KB, 1920x1080px) Image search: [Google]
gentoo.png
219KB, 1920x1080px
>>56590803
Evolution vim with extra haskell syntax highlighting
>>
>>56597360

You can't use the switch statement on string literals... at least not in the way you might reasonably expect it to behave.
>>
>>56597440
That's why you just use if/else statements with strcmp

C is perfect, faggot.
>>
>>56597469
>if/else is the same as switch
you stink of desperation
>>
I regret all the time I spent with JavaScript/HTML/CSS/PHP/Rails

People, don't fall for the webdev meme. It's not "easier" to learn or anything.

If you're new, pick one of the following to start, depending on your interests:

C, Python, Java

Doing a Java course now and it's so much better than webshit.
>>
>>56597469

I will agree that C is a great language. I am merely pointing out that when you are comparing language features between C# and C, one of the major differences between their switch statements is that C cannot use its switch statement with strings, where C# can. Please learn reading comprehension sometime in the near future.
>>
>>56595267
duck typing is disgusting
>>
>>56595267
you realise you can have type inference rather than non-existent typing?
>>
>>56595191
God damn. I was thinking the exact same thing.
>>
File: ProgrammingChallenges, 4.0 (HD).png (2MB, 3840x2160px) Image search: [Google]
ProgrammingChallenges, 4.0 (HD).png
2MB, 3840x2160px
>>56595657
>>56595546

Here's the latest version of that
>>
I hate jira. I hate sprint planning.
>>
>>56597938
Those difficultly levels are hilariously useless.

>ROT13
>an entire working imageboard
>same difficulty
>>
>>56598072
VSTS is much less painful with the integrations, but I suppose that depends on if you're doing Java dev.
>>
new thred when
>>
>>56598419
New Thread NOW:

>>56598460
>>56598460
>>56598460
>>56598460
>>
>>56597363
Why bother with Printf?
main = putStrLn (s ++ show s)
s = "main = putStrLn (s ++ show s)\ns = "
Thread posts: 316
Thread images: 39


[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.