Previous Thread:
/dpt/ - Daily Programming Thread
what were you programming when turkey died?
Speaking of which, does anyone have questions about how to do things in Ada?
I support the coup, but that's not programming related
OP here
Never used Ada in my life
Nobody has
oh shit forgot to ask
What are you working on, Sup Forums?
spraying this on my mozzarella firefox
Working on a Sup Forums Android client for a CS exam
First for Python
I want to customize the CSS on Atom for a theme that looks like vim, but have no idea how to do anything... Any tips?
Why is it that in these generals you guys only talk about hipster languages and in the real world I only see Java and C++?
I do
NEETs don't belong in the real world
Just start doing shit with it until you get the hang of it, if you want something very specific just google it, CSS is pretty easy.
Are there any good coding podcasts for newfriends?
Because, we're all sick of the corporate backed bs?
>le epic counterculture anonymoose h4x0r fuck the corporate system
Go back to the Mr. Robot thread fag.
Anyone wanna give me some optimization advice?
working on pset5 for CS50, and i've finished it, it works, and is reasonably fast.
however, it could be faster. specifically, loading a trie from an alphabetized dictionary takes my code ~0.09s, while the staff's implementation is ~0.04s
Here are the relevant functions, which are the major slowdown of the program:
bool load(const char* dictionary)
{
root = mk_node();
FILE* fp = fopen(dictionary, "r");
if(fp == NULL){
printf("[!] Error: could not open dictionary %s\n", dictionary);
fclose(fp);
exit(1);
}
// iterate through the dictionary
int c;
node* current = root;
for(c = fgetc(fp); c != EOF; c = fgetc(fp)){
if(c != '\n' && c != '\''){
if(current->next[c-'a'] == NULL)
current->next[c - 'a'] = mk_node();
current = current->next[c-'a'];
}
else if(c == '\''){
if(current->next[26] == NULL)
current->next[26] = mk_node();
current = current->next[26];
}
else{
current->word = true;
dictionary_size++;
current = root;
}
}
fclose(fp);
return true;
}
and this is the function to malloc and zero a new node:
node* mk_node(void){
int i;
node* n = (node*) malloc(sizeof(node));
if(n == NULL)
return n;
n->word = false;
for(i = 0; i < CHAR_COUNT; i++)
n->next[i] = NULL;
return n;
}
My OffRailsfU tripcode is now defunct because reasons. I will be using another tripcode later on, and my secure tripcode in the mean time.
Oh thank god your tripcode is safe we're all fucking looking forward to a /dpt/ full of tripcodes
Sure thing, buddy.
Whatever happened to that other guy, that was making a language called Pipes or whatever?
What am I doing wrong with wpf data binding?
The image works if I set the content directly to the resource.
The converter is called, but the image is not updated.
It's a list view, the label that's also in the view is updated correctly to the bound model data.
App.xaml
Mypage.xaml
MyPage.xaml.cs
public static readonly DependencyProperty ImgProperty =
DependencyProperty.Register("Img", typeof(ImageSource), typeof(MyPage), new UIPropertyMetadata(null));
public ImageSource Img
{
get { return (ImageSource)GetValue(ImgProperty); }
set { SetValue(ImgProperty, value); }
}
MainWindow.xaml
StringToImgConverter.cs
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var valueString = value as string;
if (valueString != null)
{
if (valueString == "a")
{
}
else if (valueString == "error")
{
return App.Current.Resources["WarningImage"];
}
}
return null;
}
I have a Python question regarding the scopes of for-loops. Currently, I have two list of files (graph & stats) I need to loop through, which is passed through a function that extracts data from the files, and then the data is passed into another function for further processing.
for i in graph_files:
xm, ym, = get_graph_data(i)
for j in stat_files:
sr, sm = get_stats_data(j)
plot(xm, ym, sr, sm)
This gives me an undefined error. I tried defining them first (xm, ym, sr, sm = None), but that seems to be throwing a bunch of None's into the plot() method.
What do?
I remember having problems because didn't setted the Build action to Resource. IDK why you aren't declaring a FrameworkPropertyMetadata and passing it as the last parameter of the Register method.
Anyway, which resources/books are you using to learn WPF?
>xaml
yeah fuck that shit. that's why i use rust and go
why don't you use memset instead of
for(i = 0; i < CHAR_COUNT; i++)
n->next[i] = NULL;
?
post the actual error here, like the log
Yeah, I've been using mainly Rust. Go isn't really useful or interesting at all for me (Don't do much network / web server code where Go really has it's strength.)
That being said I still use a lot of C++. It's the language I've done most of my work in.
I cannot stand java at all.
i didn't think of it while writing it, but good idea.
saves about ~0.02s
I also started reading one word at a time, rather than using fgetc().
could continue down that road and read larger and larger chunks, but it would require more refactoring.
Why don't you just use calloc?
>not portable
post the portable version then Mr.portable
I honestly don't remember. It used to be that memelangs were all the rage here.
Yes it is.
How shit is my code for brute-forcing a word puzzle?
from collections import defaultdict
def load_words(path):
with open(path) as infile:
return [line for line in map(str.strip, infile) if line.isalpha]
def valid_full_word(word):
return len(word) == 10 and word[0] == 'd' and word[-1] == 'n'
def main():
words = load_words('enable1.txt')
words = list(filter(lambda s: len(s) > 1 and len(s)
i was joking. the idea being that those languages (while not as widely used in a corporate setting) are still the babies of corporate giants (you could make a case for mozilla but eh come on). realistically the most effective languages with mature compilers are largely gonna be ones in which multibillion dollar companies have a vested interest. what can you do. i use C++ and sometimes C# which is a shitload better than Java
I've been programming in C++, almost always in the terminal/XCode... How would I go about creating graphics for my code? I know how to use Processing, but it's not nearly as versatile as I'd like it to be...
Any tips?
print '\n'.join(word for word in full_words)
Meh, it's just definite definitions of corporate (Made vs Widely used by). I'm just trying to say all the "meme" languages in dpt are from devs being sick of a strict regiment of Java, C, and C++.
what kind of graphics?
OpenGL is what you're looking for
Why are there no NEET C# programmers?
>python2
Fair point, the code block was a remnant from when it did more.
that's... optimistic. could be a factor but i think it might have more to do with that most of the people in /dpt/ are hobbyists. not like NEETs are getting tired of the language they use in their day job
because C# makes you employable. can't have that now can we?
You should either put the filter stuff in load_words, or else make it a generator. You are created two lists for no reason.
Use 1 < len(s)
Thanks! Any books/resources on learning to use OpenGL?
This is a good resource: learnopengl.com
>tfw can't focus on programming because coup
Are you in Turkey?
No, but it's too exciting to watch unfold
>coup
there will be no coup, though
why?
you're clueless
I'm being sonichu levels of retarded here, but if I already have XCode, where do I download OpenGL?
lol fuck off
you can't just say
>hurr durr it's not portable
without posting the portable version , or proving why it isn't
kys
see here on the right side of the page
Getting a weird error when I click the "Learn More" button
{"responseId":"11f2edff-996d-4904-9b7f-277bebde290b","resultCode":1003,"resultString":"request.uri.notfound","userString":"Invalid request, Service mapping to the requested URL is not available. ","creationTimestamp":"2016-07-16T00:53:27Z","userLocale":"en_US","requestUrl":"developer.apple.com:443
well i don't a apple computer, but when i click on that it throws:
>Your session has expired. Please log in.
>forums.developer.apple.com
Thanks! Gonna download the 7.2 Graphics Library in pic related
Nothing because I don't have any ideas on anything that wouldn't look dumb on a github profile.
>Nothing because I don't have any ideas on anything that wouldn't look dumb on a github profile.
You should program what YOU want, not what others MIGHT think of as cool or uncool.
Write a compiler for your own programming language
while YOU program SHE fucks CHAD without condom
That's TRUE whether YOU program or NOT
Who is SHE? Who is CHAD?
why do I suck at programming?
True, but I would like to get a job someday and I don't have a github yet, so I need to get started with stuff people would like.
SHE is the girl who once laughed at your joke. CHAD is the tall, attractive man who you dislike for reasons you cannot articulate.
I figured out how to do fizzbuzz in Ada
procedure Main is
procedure Fizz_Buzz;
pragma Import (C, Fizz_Buzz, "fizz");
begin
Fizz_Buzz;
end Main;
She is that cute asian girl in your CS program you never got the balls to ask out. He is the guy that went for the PHD but still managed to look cool.
Chad here
All you guys have to do is pretend to be a confident male and fake it until you get good at it then you will get all the women
I don't know any of these people
This should work. What is wrong?
Also, what were the very first original programs you wrote?
Forgot to mention the compiler hangs
>Forgot to mention the compiler hangs
>scanf("%d",&a);
are you retarded?
its waiting for your input you dip shit
just put a random number
KEK
Thank you, I just realized this, I scrapped a slightly larger "program" from this error, bear with me, I'm just learning C
(You)
:^)
How shit is this.
cd "C:\Program Files\LiveStreamer"
powershell -Command "Invoke-WebRequest "livestreamer-builds.s3.amazonaws.com
powershell -Command "Invoke-WebRequest "rtmpdump.mplayerhq.hu
PowerShell Remove-Item -Path 'C:\Program Files\LiveStreamer\*' -exclude live.zip,rtmpdump.zip,LVUP.cmd -force -recurse
"C:\Program Files\7-Zip\7z.exe" x live.zip -aoa
cd "C:\Program Files\LiveStreamer\liveStreamer*"
xcopy * "C:\Program Files\LiveStreamer\" /E
cd "C:\Program Files\LiveStreamer"
"C:\Program Files\7-Zip\7z.exe" x rtmpdump.zip -aoa
cd "C:\Program Files\LiveStreamer\rtmpdump*"
xcopy * "C:\Program Files\LiveStreamer\" /E
cd "C:\Program Files\LiveStreamer"
del live.zip rtmpdump.zip
for /d %%x in (liveStreamer-v*) do rd /s /q "%%x"
What did I do now?
>scanf("%d",&a);
returns "Hello, %d" as pic related
Nigga are you Linux without any kind of graphical environment?
Am I?
This is the best shitposting so far
its not %d , its %s
%s its for strings
%d its for numbers
You aren't
Not shitposting, just new
Thank you
Apart from programming languages, what are software design things one should know?
What of the software engineering, software architecture (what's even the difference between these two?) is a meme and what is useful?
Any good books?
Just learn for loops, switch statements and if statements. Along with variables, if you are creative, you can solve literally any problem.
...
What's the point in getters and setters if your function isn't threadsafe regardless?
>Pentium 3
You're still using that thing? I had got a 733MHz Celeron at this time, slow as fuck by todays standards, even with a lightweight Linux distribution.
make them private
Yeah but why would I do that if the function isn't threadsafe and I need to access the variable from outside the function?
All it does is add a shitload more clutter to the code for no reason.
add semaphores and thread locks then
couldn't care less
Look up X my friend
why
would
I
do
that
if
the
function
is
not
threadsafe
though
i
don't
give
a
single
fuck
let
me
sleep
already
>I'm too dumb
ok