[ / / / / / / / / / / / / / ] [ dir / agatha / animu / asmr / ausneets / leftpol / orbg / sw / ztg ][Options][ watchlist ]

/tech/ - Technology

You can now write text to your AI-generated image at https://aiproto.com It is currently free to use for Proto members.
Name
Email
Subject
Comment *
File
Select/drop/paste files here
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Expand all images

File (hide): a23ae2b0566c5aa⋯.png (41.59 KB, 400x300, 4:3, hello_opengl.png) (h) (u)

[–]

 No.793034>>793035 >>793099 >>793181 >>793258 >>797975 >>802488 >>802978 >>803004 >>803224 >>803253 >>804982 >>808630 >>808631 >>809143 >>810531 >>812152 >>847299 [Watch Thread][Show All Posts]

What are you working on, /tech/? Don't be shy about asking for help or code review. Keep your posts on-topic, please.

Hastily written roll script for the challenge image:

https://0x0.st/7ML.txt

Didn't bump the other thread because it was bait

 No.793035>>793036

>>793034 (OP)

unixtime(this_post) % 145, how fucked would I be?

not doing anything on this list because I've got enough shit to do as is


 No.793036

>>793035

>sierpinski triangle

well that's fucking boring.


 No.793088>>793155

/tech/ doesn't program


 No.793099

>>793034 (OP)

Trying out embedding/extending. I'm both regretting the fact that I wrote custom file formats for config files instead of using Lua but also excited by getting a REPL inside my program.


 No.793101>>834553

Trying to identify islands in an image but I'm retarded. I want to hilight regions as if by using a fuzzy select and then get data such as dimensions, color vs global values and surrounding islands to feed into another program.


 No.793146>>793253

I decided to make a terminal-based browser of sorts. Instead of using HTML and CSS, it uses it's own format. Each page is a YAML file with a list of instructions, such as drawing a border or line, or adding text. It supports foreground and background colours too. It assumes the terminal is 80x24 for now, but I'm planning on expanding that.

It's mostly an excuse to mess with dispatch tables. The main loop for processing each instruction is a simple:


for (@{$yaml->[0]->{draw}}) {
$draw{$_->{command}}->($_);
}


 No.793155>>805696

File (hide): 74b21510cf31c0f⋯.gif (631.15 KB, 512x481, 512:481, SpinningSpurdo.gif) (h) (u)

>>793088

No, what we do is

BROGRAMMING!


 No.793181>>793186 >>834556

>>793034 (OP)

>opengl

>>>/v/


 No.793186

>>793181

>implying opengl is useful only for games


 No.793253>>793262

>>793146

>current_perl + 0.18

>not writing it as for ($yaml->[0]{draw}->@*) {


 No.793257>>793260 >>852223

What are some employable things to learn?

Django

ReactJS & Angular (how common?)

Firebase (for android dev.. don't really know what's common 'stack' there or just plain android SDK)

Java EE (that shit gives me cancer.. everything has a dependency of dependency with their separate XML config files)

I'm too dumb to work with C, sure I can use it for hobby projects but I suck at math and logical thinking.


 No.793258

>>793034 (OP)

Let's see what I get.


 No.793260>>793261

>>793257

>I suck at math and logical thinking

>I want a job as a programmer


 No.793261

>>793260

well i guess math only. i can do threading and stuff like that but often C programs have things that really need math like reggressions or quaternions.


 No.793262

>>793253

Is there list of syntax changes like that somewhere? @* just brings up irrelevant stuff.


 No.793279>>793286 >>793332 >>793336 >>793372

File (hide): 05feb9b465d34bd⋯.png (539.94 KB, 1434x875, 1434:875, 2017-09-13-154522_1434x875….png) (h) (u)

Learning how to use gtk and learning gui programming in general. It seems pretty easy when doing small helloword programs, and I don't really see it getting more complex than just managing events.


 No.793286>>793288

>>793279

What are you using to learn gtk?


 No.793288

>>793286

The tutorials on the Gnome Developer site. It probably isn't the best way to learn it, but it seems to cover most of the important concepts like frames and events and such that you would expect out of a GUI library.


 No.793332>>808637

>>793279

>Gtk+

>yfw Gtk+ is a recursive acronym that contains a recursive acronym that contains a recursive acronym

>yfw Gtk+ means GNU's Not Unix Image Manipulation Program Toolkit

>yfw you have no face, but if you did, it would be some fucked-up repeating fractal


 No.793336>>793592

File (hide): acd6abf9117540c⋯.jpg (148.02 KB, 1000x750, 4:3, pleb.jpg) (h) (u)

>>793279

>not using xlib


 No.793372


 No.793587>>797354

File (hide): 434a8ff854d0ce2⋯.gif (151.66 KB, 512x128, 4:1, hash-quine.gif) (h) (u)

programming challenge:

create an image file that contains its own md5 hash.


 No.793592

>>793336

>xlib

>not xcb


 No.793604>>793610 >>793728 >>793731

I tried programming, but i had trouble implementing a linked list as an object, so maybe I'm just retarded. Goodbye, off to kill self. Gonna stay a mechanic and just enjoy computers as a hobby.


 No.793606>>793608

Hey Angular guys, help me out on something. I'm a newb to the framework and I can't figure out this basic thing: Say I have a parent component, inside it is a child component with the directive *ngFor. Now say my parent component has a button. When I click that button, how can I make all of my child components run a particular method?


 No.793608

>>793606

> Hey Angular guys,

>>>/r/programming


 No.793610>>797977

>>793604

Don't worry too much about it, just knowing what linked lists are puts you above a fuckton of programmers.

What language are you trying it in?


 No.793695

>"open public API"

>requires sign up with name, company, intended use-case, card number, DNA sample, and the soul of your firstborn son

What did they mean by this?


 No.793728

>>793604

The OOP meme claims another victim.


 No.793731

>>793604

>implementing a linked list

Found your problem.


 No.793732>>793734

Our team is proposing an OS architected entirely around circles and the mathematical beauty of Pi. We eliminate all rectangular elements, which represent the lesser reptilian brain, by the grace of God. It shall be called CYCLESOS. It will have an API to interface with all non-rectangular elements of TempleOS via 9-pin round connectors. We begin by eliminating all support of any draw calls to 90 degree angles.


 No.793734

>>793732

As part of our mandate, all data structures will be cyclic graphs.


 No.797332>>801814

Today I implemented general problem solver in Erlang.

What are you working on, /tech/nologists?


 No.797350

Software clone of a hybrid wavetable synthesizer of the 80s. VST/LV2 and C++

I am collecting information on the analog filter and I try to find a fitting model.


 No.797354

>>793587

Hardmode: sha-256


 No.797647>>798059

Hey, tech! Is there any good way to authenticate RSS users? I want expose my app's feed as RSS but each user has some private data in his feed, so I do not want everyone to have access to that data.


 No.797654

Rolling.

Trying to improve my Go.


 No.797657>>797929

I've never programmed python before (Only know C, x86 (32 and 64 bit) ASM, z80 ASM, C++, a little amount of C#, and some haskell. I decided to take a jab at writing some python code. I want you all to tear me apart here. Give me everything I did wrong, why I suck,

and what I need to read.

Ignore the while 1, thats just cause I was lazy. And the two random gens are one for letters, one with letters and digits. I guess I should make the user choose which one rather than editing the code.



import sys
reload(sys)
sys.setdefaultencoding('utf8')
import urllib
import random, string
from BeautifulSoup import BeautifulSoup
import os
from termcolor import colored
header = " ==== URL SHORTENER FUZZER === "
def randomword(length):
letters = string.ascii_letters
letters = letters.replace(" ", "")
return ''.join(random.choice(letters) for i in range(length))

def randomall(length):
letters = string.ascii_letters + string.digits
return ''.join(random.choice(letters) for _ in range(length))

def GrabWebsite(site):
link = site + randomword(6)
reply = urllib.urlopen(link)
code = reply.getcode()
if code == 404 or code == 403:
back = "1 " + link

else:
soup = BeautifulSoup(urllib.urlopen(link))
if soup.title is None:
back = "No Title"
else:
soup = soup.title.string
if soup is None:
back = "No Title"
else:
back = link + " : " + soup.decode('utf-8')
return back
def stats(siteOUT, ranAlready, FourOFour, TwoHundos):
print colored(header , "green") + "\n\n"
print colored("404's : ", "red") + colored((str((FourOFour / (ranAlready * 1.000)) * 100) + "%"), "red")
print colored("200's : ", "cyan") + colored((str((TwoHundos / (ranAlready * 1.000)) * 100) + "%"), "cyan")

return 0;


os.system("clear")
print colored(header, "green") + "\n\n"
site = raw_input("Website to fuzz: ")
os.system("clear")
x = 0
FourZeroFour = 0
TwoHundos = 0
f = open("FuzzOut.log", "w")
f.close
file_object = open("FuzzOut.log","r+")
file_object.write("T\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
while 1:
file_object.seek(0)
x += 1
siteOUT = GrabWebsite(site)
if siteOUT[0] == "1":
FourZeroFour += 1
else:
TwoHundos += 1
file_object.seek(x)
file_object.write(siteOUT.encode('utf-8'))
file_object.seek(0)
os.system("clear")
stats(siteOUT, x, FourZeroFour, TwoHundos)
readfile = file_object.readlines()
print "URLBeingRan: " + siteOUT[2::]
print "\n\n ---- LAST 10 FOUND SITES ----"
for line in readfile[-10::]:
print line


 No.797679

roll


 No.797681

fuck reroll


 No.797706>>797708

roll


 No.797708

>>797706

reroll????


 No.797718>>797735

roll


 No.797735>>797736

File (hide): 04ac3cc9b3b425c⋯.jpg (68.48 KB, 850x567, 850:567, alex_jones shirtless.jpg) (h) (u)

File (hide): 675bb42d3b13732⋯.png (63.71 KB, 1502x997, 1502:997, alex.png) (h) (u)

>>797718

had to install rust and microshit visual c++ build tools first

https://play.rust-lang.org/?gist=71c286cf4179564b313e5d26f867ec22&version=stable


 No.797736>>797738

>>797735

>rust and microshit visual c++ build tools first

>microshit visual c++ build tools first

>microshit

Visual C++ thing is required only if you are using Rust on windows.

Why are you calling them microshit if you support them by using their product?


 No.797738>>797743

>>797736

im currently visiting my parents and didn't take my laptop with me, so i enriched my mothers laptop with rust


 No.797741>>797742

roll


 No.797742

>>797741

IP...

Tracking...

Visualization... ?

I know what all of those words mean...


 No.797743

>>797738

I hope you obtained her consent before culturally appropriating her precious megabytes


 No.797929>>798261 >>798526

>>797657

Use Python 3 instead of 2, and get off Windows. This is just generically bad code, it doesn't even reach the stage of being bad Python.

Your random* functions duplicate functionality and the only difference is the data they use. Make it a single function and pass "letters" as an argument (this will also make it more convenient for you to change depending on user input). Also, consider generating "letters" variables at the top-level instead of every single time you call these functions.

The code in your top level below the stats function should be moved into its own scope. You could wrap it in a main function and call it after checking that Python is calling the script directly.


if __name__ == "__main__":
main()

With those os.system("clear") calls, overly complicated prints, and that log file, I think you miss the point of how stdout/stderr is meant to be used. You should be using them to log (you can redirect stdout to a file).

By the same token, you should prefer using command line arguments over raw_input() to get input. Interactivity like this just makes your script inconvenient to use.

You said to ignore that infinite loop, but you really should at least surround it with a try-except, so you can catch any KeyboardInterrupt and terminate your program gracefully (e.g. by closing files).

There's probably more but these are a few initial criticisms. Don't worry, many beginners write code like this.


 No.797975>>797980

>>793034 (OP)

Honestly feel bad about coming here because I'm working on homework and it just seems I'll never be good because I feel like I can't into clever, non-pajeet solutions.


 No.797977>>804701

>>793610

C++. I actually got it done, but it was hell, and I have a bug where I can't delete the last node in the list.


 No.797980>>797987

>>797975

post your assignment. i will give you a clever solution in rust


 No.797987>>797991

>>797980

I'd rather not, because prof considers it cheating to ask for outside help, and I'm sure he browses these boards. Also

>rust

Why is this popular?


 No.797991>>797993 >>803045

>>797987

>he browses these boards

wtf????

>Why is this popular?

<Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety.

<zero-cost abstractions

<move semantics

<guaranteed memory safety

<threads without data races

<trait-based generics

<pattern matching

<type inference

<minimal runtime

<efficient C bindings

here is my public key: https://ghostbin.com/paste/r6m4p

send me the assignment encrypted. your prof wont be able to proof anything.


 No.797993>>798049 >>798059

>>797991

I mean, I suspect he does. I'll post it, but don't post any code. I'm actually right about done with it, but I suspect everyone has it easier than me in this class.


Create an empty set and add items to it. Uniqueness of items within the set must be maintained
Deletion of an item from the set. This deletion must not lose any data other than the given element to be deleted.
Print out the elements currently contained within the set. They will be printed out as {element1, element2, …}
Union between sets, as defined in class
Intersection of sets, as defined in class
Difference of sets, as defined in class
In this archive there are 4 small data files int1, int2, int3, int4. Each one represents a set. Your program will load the data from each list into individual sets and be able to evaluate the following three set equations (Note S1 refers to the set found in int1, S2 to int2, …). We may test your program using different (but similarly sized) data sets, so your program should be able to handle files specified by the user as opposed to hard coding the file names in. Your program must print out each equation, and then display the result. Display of the work during intermediary steps is not necessary for the final submission, but it may be helpful for debugging purposes during coding. You will NOT be counted off if the work is left in the final submission. Example output: EQ1: S1 (S2 - S3) = {1,2,3,4,5,6,7,8,9,10}
((S1 S4) S3) S2
(S1 S2) ((S3 S2) (S4 S1))
S4 S3 S2 S1
(S3 ((S1 S3) (S2 S4)

A basic hash table implementation will be provided, bonus points will be given if you create your own implementation. Each implementation and the resulting analysis is worth 1/3 of the assignment grade. Due to the small size for most of the datasets, we will do this analysis by counting the loop iterations our various set operations go through as opposed to a time metric. As an example, the loop in the pseudocode below will execute the inner loop between 1 to m times, where n is the size of the array, and the outer loop 1 to n times, giving it a big-O of O(m*n).
for(int i = 0; i < set.size(); i++)
for(int j = 0; j < array.size(); j++)
if(set[i] == array[j])
break


 No.798049>>798259


 No.798059>>798069

>>797647

HTTP Basic Auth

>>797993

Python already has sets, but I implemented a new one with those requirements.

class Set(object):
"A set implementation."
def __init__(self, *args):
self.items = []
for arg in args:
self.add(arg)

def __str__(self):
"String representation of this object."
return "{"+", ".join(self.items)+"}"

def __repr__(self):
"The representation of this object."
return "<Set "+str(self)+">"

def __add__(self, other):
"Add an item based on its type."
if isinstance(other, Set):
return Set(*(self.items+other.items))
elif isinstance(other, list):
return Set(*(self.items+other))
else:
raise TypeError("Can only concatenate list or Set (not \"{}\")"
.format(type(other)))

def __or__(self, other):
"Does an union with another set."
assert isinstance(other, Set), \
"other object is not a Set"
return self.union(other)

def __and__(self, other):
"Does an intersection with another set."
assert isinstance(other, Set), \
"other object is not a Set"
return self.intersect(other)

def __xor__(self, other):
"Returns the difference of two sets."
assert isinstance(other, Set), \
"other object is not a Set"
return self.difference(other)

def __getitem__(self, key):
"Returns an item on index key."
return self.items[key]

def add(self, item):
if not item in self.items:
self.items.append(item)

def remove(self, item):
assert item in self.items, \
"Item not in set"
self.items.remove(item)

def union(self, other):
return self + other

def intersect(self, other):
concat = self.items + other.items
intersect = [i for i in concat
if i in self.items and i in other.items]
return Set(*intersect)

def difference(self, other):
concat = self.items + other.items
difference = [i for i in concat
if not (i in self.items and i in other items)]
return Set(*difference)

if __name__ == "__main__":
a = Set(1, 2, 3)
print(a) # {1, 2, 3}
print(repr(a)) # <Set {1, 2, 3}>
print(a + 7) # {1, 2, 3, 7}
print(a + Set(4, 5, 6)) # {1, 2, 3, 4, 5, 6}
print(a | Set(2, 3, 4, 5)) # {1, 2, 3, 4, 5}
print(a & Set(2, 3, 4, 5) # {2, 3}
print(a ^ Set(2, 3, 4, 5)) # {1, 4, 5}


 No.798069

>>798059

There are a few bugs in this, here's the fixed version:

class Set(object):
"A set implementation."
def __init__(self, *args):
self.items = []
for arg in args:
self.add(arg)

def __str__(self):
"String representation of this object."
return "{"+", ".join(map(str, self.items))+"}"

def __repr__(self):
"The representation of this object."
return "<Set "+str(self)+">"

def __add__(self, other):
"Add an item based on its type."
if isinstance(other, Set):
return Set(*(self.items+other.items))
elif isinstance(other, list):
return Set(*(self.items+other))
else:
raise TypeError("Can only concatenate list or Set (not \"{}\")"
.format(type(other)))

def __or__(self, other):
"Does an union with another set."
assert isinstance(other, Set), \
"other object is not a Set"
return self.union(other)

def __and__(self, other):
"Does an intersection with another set."
assert isinstance(other, Set), \
"other object is not a Set"
return self.intersect(other)

def __xor__(self, other):
"Returns the difference of two sets."
assert isinstance(other, Set), \
"other object is not a Set"
return self.difference(other)

def __getitem__(self, key):
"Returns an item on index key."
return self.items[key]

def add(self, item):
if not item in self.items:
self.items.append(item)

def remove(self, item):
assert item in self.items, \
"Item not in set"
self.items.remove(item)

def union(self, other):
return self + other

def intersect(self, other):
concat = self.items + other.items
intersect = [i for i in concat
if i in self.items and i in other.items]
return Set(*intersect)

def difference(self, other):
concat = self.items + other.items
difference = [i for i in concat
if not (i in self.items and i in other.items)]
return Set(*difference)

if __name__ == "__main__":
a = Set(1, 2, 3)
print(a) # {1, 2, 3}
print(repr(a)) # <Set {1, 2, 3}>
print(a + [7]) # {1, 2, 3, 7}
print(a + Set(4, 5, 6)) # {1, 2, 3, 4, 5, 6}
print(a | Set(2, 3, 4, 5)) # {1, 2, 3, 4, 5}
print(a & Set(2, 3, 4, 5)) # {2, 3}
print(a ^ Set(2, 3, 4, 5)) # {1, 4, 5}
print(a[0], a[1], a[2]) # 1 2 3


 No.798259


 No.798261>>798274

>>797929

>Use Python 3 instead of 2

No, use python 2. There's nothing good in python 3 that hasn't been backported. The only thing 3 gives you is reduced library compatibility. Skip 3, wait for 4.


 No.798268

I did rust for a while, but the syntax really stikes me as very explicit. I'm looking to write either a blockchain or a kademlia DHT with it. I'm waiting for these recent RFCs that go accepted to be implemented (GATs are gonna be dope)

I'm reading haskell from first priciples, lambda calculus is fun, I'm going t use it for blockchain related adventures.


 No.798274>>798275 >>798290

>>798261

>listening to Zed Shaw


 No.798275>>798278

>>798274

>using a non turing complete language becuase it has the bigger version number


 No.798278>>798280

File (hide): ed5310a55234341⋯.jpg (20.04 KB, 303x303, 1:1, nice.jpg) (h) (u)

>>798275

>Python 3 isn't Turing complete

Are you brain damaged?


 No.798280>>798281 >>798289

>>798278

In computer science a fundamental law is that if I have one Turing Machine I can build any other Turing Machine. If I have COBOL then I can bootstrap a compiler for FORTRAN (as disgusting as that might be). If I have FORTH, then I can build an interpreter for Ruby. This also applies to bytecodes for CPUs. If I have a Turing Complete bytecode then I can create a compiler for any language. The rule then can be extended even further to say that if I cannot create another Turing Machine in your language, then your language cannot be Turing Complete. If I can't use your language to write a compiler or interpreter for any other language then your language is not Turing Complete.

Currently you cannot run Python 2 inside the Python 3 virtual machine. Since I cannot, that means Python 3 is not Turing Complete and should not be used by anyone.


 No.798281

>>798280

>copypasting Zed Shaw's retardation instead of actually understanding the concept of Turing Completeness


 No.798289

>>798280

I thought you were retarded at first, but now I see you're just pretending.


 No.798290>>798296

>>798274

Give me a reason to use python 3 that isn't because the number is bigger.


 No.798296>>798298 >>798361

>>798290

* Increased syntactic consistency

* Unified type for real numbers

* Better standard library


 No.798298>>798300 >>798302

>>798296

rust has all of those and much more


 No.798300>>798304

>>798298

Does it have sane people using it?


 No.798302>>798304

>>798298

Also included in rust:

* horrible syntax

* not adopted widely

* fewer learning resources available (compared to C/C++)

* Vec<Rc<RefCell<Box<Trait>>>>

* CoC

* Steve Klabnik


 No.798304>>798338 >>798348

>>798300

https://www.rust-lang.org/en-US/friends.html

>>798302

>muh syntax

>Vec<Rc<RefCell<Box<Trait>>>>

>CoC

>Steve Klabnik

kys

>muh adoption

for a language that is ~2.5 years old it's adoption is quite good

>fewer learning resources available

it doesn't need as many because it isn't such a clusterfuck as c++


 No.798338

>>798304

The adoption is just the beta tester generation. Once Rust actually releases anything stable they'll move on to the next corporate abortion.


 No.798348

>>798304

>kys

T.N. kys means "you're right"


 No.798361>>798367

>>798296

>Increased syntactic consistency

Oh yeah, that's way better than having compatible libraries. Good job.

>Unified type for real numbers

Who the fuck uses real numbers in raw python? Everyone that needs those uses numpy.

>Better standard library

Everything was backported or replaced with a less braindead library (see: asyncio).

Once again, the python 3 crowd showing they really just use it because the number is bigger and don't know any better.


 No.798367>>798407

>>798361

>Oh yeah, that's way better than having compatible libraries. Good job.

>changing syntax between MAJOR versions is bad

>Who the fuck uses real numbers in raw python? Everyone that needs those uses numpy.

Not an argument. This is obviously an improvement.

>Everything was backported or replaced with a less braindead library (see: asyncio).

Backported, causing months of duplicated effort.

Once again, the python 2 crowd showing they really just use it because it's hip and cool to dislike things other people do.


 No.798407

>>798367

>obviously an improvement

>to a feature zero people will ever see as everyone uses numpy on top of the raw types as python is otherwise useless for math

I'm still laughing that you even brought this up as a reason to use python 3. You must have never used them.

>Backported, causing months of duplicated effort.

How the fuck would this matter for my decision to use python 2 or 3? The reality today is that python 2 and 3 are nearly identical other than python 3 having WAY less library compatibility. Even flup doesn't have an official python 3 version and Debian doesn't maintain it[1]. How much duplicated effort would it be for me to port and maintain all the libraries I need? Fucking LARPing moron.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=873492


 No.798443>>798447

In C++, why isn't it legal to pass an array of ifstream type pointers to a function? Seems I can open the files into that array, but cannot traverse the array once passed.


 No.798447>>798466

>>798443

Post code, you sound like you don't know what you're doing.


 No.798466>>798477

>>798447

>you sound like you don't know what you're doing.

If only you knew how right you were.


std::ifstream fileno[4];
for(int i = 0; i < 4; i++){
fileno[i].open(argv[i+2]);
if(!fileno[i].is_open()){
errorMessage(1);
exit(1);
}
}
f(&fileno);

So that's how it starts. Seems to go just fine, and the passing to a function just breaks.

What I'm trying to do once it gets to that other function is this


for(int i; i < 4; i++){
while(*file[i] >> x){
h[i].push(x);
}
}


 No.798477>>798478

>>798466

Different anon - pass it as f(fileno) to a function defined as void f(std::ifstream *fileno). While you could do void f(std::ifstream (&fileno)[4]), that's disgusting, don't do it. It's awkward if you learned C++ before C because this is where C++ shits the bed but C programmers don't notice as they'd not have tried doing it.


 No.798478>>798482 >>802107

>>798477

Tried that.


 No.798482>>798500 >>802107

>>798478

You'll also need to access it like (*file)[i].


 No.798500

>>798482

Ah, that probably makes the difference.


 No.798526>>798635

>>797929

I'm not using windows, have been using linux for the last 6 years. And Void linux for 3.

Oh yeah I removed the extra random function and made a toggle at the beginning to allow you to choose specifics by editting the Ascii strings to include different characters.

Taken note on the stdout going to work on that now. Also with the command line args.

Thank you a lot man, I appreciate the help


 No.798635

>>798526

Learning programmers on Windows are notorious for using os.system(), hence my false assumption. Also, I realise I didn't explain enough about stdout/stderr.

A good general rule is to use stdout for nothing other than logical program output (in your case, that might be something like the URL followed by title for every site you find). This allows you to pipe the output of your script to another script to perform tasks without having to worry about filtering out unrelated messages. stderr is then used for debug/error/info/diagnostic information that you wouldn't typically want sent to another program.

If you do want to make a nice interactive UI for your program, you can look into using something like tkinter/gtk/qt for a GUI or curses for a terminal-based interface. Programming for a UI requires a bit more legwork than throwing together a script.

Glad you got something out of it.


 No.801418

Having fun with dates. DST is like a spot of sunshine in an otherwise sane world.

I mean why would day+1 == day+1.


 No.801645>>801647

File (hide): 1ebb376532474c8⋯.png (499.67 KB, 800x600, 4:3, picpic.png) (h) (u)

Is there a usual SDK version / minSdkVersion that is used for new android apps? I need to quickly learn and want to focus on relevant things.


 No.801647>>801664 >>801817

>>801645

use https://flutter.io/

it is the future of mobile dev


 No.801664>>801726


 No.801726

>>801664

not an argument


 No.801814

>>797332

But can it solve my alimony payments


 No.801817>>801918

>>801647

as of now flutter is a meme. still in alpha.

I have to write a cross platform iPhone/Android app with AES encryption, bluetooth, networking, and use of a lot of fragments. at least fragments are what they're called in Android. I was looking at cordova, but even in that the bluetooth support isn't looking the best. need to use plugins. anyone have a suggestion of what I should use?


 No.801918>>802357

>>801817

>AES

kek. use keccak for crypto

https://keccak.team/keyak.html


 No.802032>>802045

So apparently my compsi prof uses Allman-style brackets. I use Stroustrup because unlcle Bjarne's book was the first one I read on the subject and also because I came off reading K&R while I was debating doing programming. His is a slight variation on this.

So, I guess my question is, what does /tech/ prefer? And why? I find Stroustrup-syle more readable, because the bracket can be traced back to what is actually encompassing it instead of another bracket, and makes code more compact.


 No.802045>>802050

>>802032

I use strousoup even though I didn't know it was called that. The reason I use it is because of readabilty and also I must admit I am partial to some nice soup. Chicken soup or even mushroom soup. Soup soup soup. Soup style is the best. Yay soup!


 No.802050

>>802045

>soup

Moot, is that you? If so, fuck you.


 No.802107>>802191

>>798478

Tried that and what happened?

>>798482

What? That would dereference the first stream and call operator[] on it, wouldn't it?

Using [] on a pointer already dereferences it, so the syntax is the same as it would be on an array.


 No.802191

>>802107

>Tried that and what happened?

I did it wrong. You were actually correct. I turned in the assignment and it all worked.


 No.802357>>802359

>>801918

AES is perfectly fine. Secure and simple. On desktop I just have aes.c and aes.h for encryption with no other dependencies. Java has AES support built in. Probably what I'm going to end up doing for the app though is Phonegap and writing some of my own native code if I can't find plugins.

Also will use a JsAES for encryption there http://point-at-infinity.org/jsaes/


 No.802359>>802482 >>802575

>>802357

>JsAES

Ah fuck nvm it's got pozzed licensing. Here's one with MIT https://github.com/ricmoo/aes-js


 No.802482

>>802359

>using crypto implemented by js retards

are you fucking kidding me?????????


 No.802488

>>793034 (OP)

Rolling, but this had better be quick.


 No.802517

XBF - eXtensible BrainFuck


 No.802575

>>802359

>GPL

>pozzed

>have my MIT cuck license instead

Yeah, we're onto you.


 No.802638>>802701 >>803017 >>803090

im reading a book called c++ for dummies gave it a break because shit's heavy in math and calculations.


 No.802701>>803004

>>802638

You might not be cut out for programming.


 No.802978

>>793034 (OP)

>What are you working on, /tech/?

Nothing right now, I learn enough to be a little bit better than beginner tier at C++, contribute small amounts to vidya projects on jewhub and then stop for a year and forget everything I learned. I have a terrible memory and shit concentration I need to fix that so rollan for a project.


 No.803004

>>793034 (OP)

>What are you working on, /tech/?

Started working my way through 'Build your own Lisp' yesterday. It's been pretty smooth sailing so far. I'm about halfway through.

>>802701

I learned C from The C for dummies books, but I was in middle school then.This was also back before amazon, and the local pleb bookstores didn't carry K&R. The Hastings had both volumes of C for Dummies, so that's what I got.

Once I learned C, one of the first things I did was port a TiBasic game from my graphing calculator.


 No.803017

>>802638

Keep at it, you'll have fun once you've learned everything.


 No.803045>>803088

>>797991

You can get all of that (or all the important parts anyway, type inference is overrated) in other languages. Take your shittily typed overly hyped shitty syntax snake oil and get out.


 No.803088

>>803045

>you can get memory safety without gc and thread safety in other languages

such as??????????

>muh syntax


 No.803090

>>802638

If you need help with the "heavy calculations", post a question.


 No.803224>>803225

>>793034 (OP)

last thing i did was add a small feature to a decoder ring command line program that i developed for the sole purpose of deciphering encrypted messages in RuneScape clue scrolls.

roll


 No.803225

>>803224

i'm not a real programmer. reroll


 No.803253>>803314

>>793034 (OP)

>What are you working on, /tech/?

Today I created my first elisp function, it is simple function that takes text as input and outputs comment with that text.

Extending emacs was easier than I expected.


 No.803272

File (hide): 9cb8b84a8c9db95⋯.jpg (34.28 KB, 960x960, 1:1, rub.jpg) (h) (u)

https://0x0.st/Flb.tar

Working on a TIS-100 / MOS6510 crossover thing. I'm definitely not doing it right but hopefully it works. Here's what I have so far.

By the way TIS-100 and SHENZHEN I/O are great games you guys should try em out.


 No.803314

>>803253

Nice. I think you only understand Emacs (or any editor) once you learn to write extensions for it.


 No.804701>>804806

>>797977

if you're still lurking, post the code anon


 No.804773>>804775

So I was drawing simple charts from data.

Started out with Ruby because I don't really know it but it seems cool. The first few hours everything was going great, defaults all worked and looked nice. Then I realised the library I was using lacked all but the simplest of options and after hacking a few more things in I gave up.

Switched to python. Defaults are terrible. Labels run off the edge of the screen. Everything needs to be hand tweaked to look passable. In the end I was thinking I should have just written my own.


 No.804775>>804785

>>804773

Just use perl+graphviz


 No.804785>>804790

>>804775

I used GD::Graph before but it looks dated.

Now that I think about it I probably should've looked at javascript.


 No.804790

File (hide): aa4ddb872712a32⋯.png (89.41 KB, 1344x1064, 24:19, graph.png) (h) (u)

>>804785

I didn't use any modules, just generate a "dot" file from your data and call it with graphviz.

Keep it simple, stupid.


 No.804806>>804808

>>804701

I will post full code when the semester ends, or when I see that I won't be needing it.


 No.804808>>804810

>>804806

Fuck you Jeff i need your code now before we have to turn in the assignment, post it you faggot!


 No.804810

>>804808

You don't want to copy my code. It's shit.


 No.804818>>804826 >>804865

File (hide): 1c091972a6bb550⋯.gif (79.97 KB, 256x256, 1:1, 1334651846498.gif) (h) (u)

since that other anon is being a faglord i'll post my linked list in c++

please rate hate and subscribe to my blog

https://pastebin.com/raw/igjks61e


 No.804826>>804833 >>804865

>>804818

Is your print_all O(n^2)?


 No.804833>>804865

>>804826

Sure thing but if you want to fix that just do something like:


if (!head)
{
return;
}

Node* node = head;
while (node->get_next())
{
std::cout << node->get() << " ";
node = node->get_next();
}
std::cout << node->get() << " ";


 No.804865>>804869 >>804873 >>804876 >>804885 >>805058

File (hide): aebb7b8ad884ff9⋯.jpg (84.83 KB, 625x496, 625:496, 1360269055.jpg) (h) (u)

>>804818

>>804826

>>804833

Updated version, someone please review it

https://pastebin.com/raw/tm3hSgis


 No.804869>>804870

>>804865

>Allman style


 No.804870

>>804869

Thank you for your constructive criticism.


 No.804873>>804877

>>804865

store a pointer to the tail in the list that way you dont have to traverse the whole list to append.

also why isnt there a method to add something to the front?


 No.804876>>804877

>>804865

store a pointer to the tail in the list that way you dont have to traverse the whole list to append.

also why isnt there a method to add something to the front?


 No.804877

>>804873

>>804876

fucking kill yourself codemonkey


 No.804881

File (hide): e8a191d60f13994⋯.jpg (46.4 KB, 720x480, 3:2, 1468803800430.jpg) (h) (u)

>fucking kill yourself codemonkey


 No.804885>>804887 >>804893

>>804865

>/tech/ actually programming

What is happening???


 No.804887>>804891 >>805523

>>804885

well it is quite bad. but it is at least something


 No.804891>>805351

>>804887

i wish that other anon would post his implementation too


 No.804893

>>804885

/prog/ is dead


 No.804923>>804931 >>805057

File (hide): 6183cb92c77a0ee⋯.png (4.93 MB, 1619x1725, 1619:1725, slyWatermelonGirlPlotsTast….png) (h) (u)

File (hide): 4209842817437ba⋯.png (685.91 KB, 679x679, 1:1, straightData.png) (h) (u)

I've been working on a fun C++ project to convert file to images, and even place files as random pixels in another image, which can later be extracted if you know the random seed that was used to create it.

Attached are two examples, one of a data file converted straight to an image, and the other of the of the same data file placed into another image. The idea is that any website which allows you to post png images can easily be used to share any type of file.

I'm using the Mersenne Twister 19937 generator to get platform independent random number sequences, with the seed specified by the user both at creation time and extraction time. So far I've tested it successfully on Linux and OSX.


 No.804931>>804936

File (hide): 71cccba693d5027⋯.png (187 KB, 279x337, 279:337, 1481235789555.png) (h) (u)

>>804923

>daily programming thread

>hey look at this non-code guys!


 No.804936>>804939

File (hide): a25357330ab29d1⋯.png (623.12 KB, 646x646, 1:1, sourceCode.png) (h) (u)

>>804931

I wanted to see if there was any interest before posting the code, because it's spread across several different class files, and I didn't want to spend the time uploading it somewhere if nobody cared. Pic related is the source code. If anyone is interested I'll post it as plain text too.


 No.804939>>804942

>>804936

Ignore the spergs and upload it to github


 No.804942>>804945 >>804951

>>804939

What's a good alternative to github? Github locked me out after a student trail I had expired, and it's become a total SJW shithole.

For now I'll upload a zip to mixtape.moe. It does depend on ImageMagick because the CImg library uses that for resizing images and stuff.

https://my.mixtape.moe/usrukd.zip


 No.804945>>804950

File (hide): 7a794e2a39cb78a⋯.jpg (8.87 KB, 259x327, 259:327, 13246894894.jpg) (h) (u)

>>804942

>macos


 No.804950

>>804945

Fuck, you caught me. I was testing cross operating system compatibility.


 No.804951>>804955

>>804942

>those comments

C'mon on


 No.804955

>>804951

I actually wrote most of it a few years back, but finally just fixed one last bug. The code and comments are admittedly not great. Constructive, or destructive, criticism is welcome.


 No.804982>>805146

>>793034 (OP)

roll


 No.805042

The extent of my programming has been in VBScript in Libreoffice lately, just to do very basic surveying-related stuff. It's pretty crude doing it like that though, might be worth looking into SciPy or something like that.


 No.805057>>805062 >>805079

>>804923

>mersenne twsiter 19937

https://en.wikipedia.org/wiki/Mersenne_Twister

>It was designed specifically to rectify most of the flaws found in older PRNGs

it is actually one of the worst prng's. a complete ant total meme only popular because of c++.

literally even lcg's are better.


 No.805058>>805061

File (hide): 692248fe4bfe49c⋯.png (62.2 KB, 326x326, 1:1, stop.png) (h) (u)

>>804865

>getters and setters that do fucking nothing


 No.805061>>805065

>>805058

what should you do instead? public fields?


 No.805062>>805066

>>805057

What should be used instead when you're in C++ land?


 No.805065

>>805061

Ding Ding Ding!


 No.805066>>805067 >>805346


 No.805067>>805068

>>805066

forgot to add: made by a woman

if you add that to your project, you will instantly get many diversity points


 No.805068>>805070

File (hide): a7de2cec278f82c⋯.png (16.01 KB, 550x404, 275:202, 1491313298575.png) (h) (u)

>>805067

>made by a woman

broofs?


 No.805070>>805071

>>805068

>reading a website is too hard for me

>please spoonfeed me

@techreport{oneill:pcg2014,
title = "PCG: A Family of Simple Fast Space-Efficient Statistically Good Algorithms for Random Number Generation",
author = "Melissa E. O'Neill",
institution = "Harvey Mudd College",
address = "Claremont, CA",
number = "HMC-CS-2014-0905",
year = "2014",
month = Sep,
xurl = "https://www.cs.hmc.edu/tr/hmc-cs-2014-0905.pdf",
}


 No.805071>>805073

>>805070

Okay so it's a tranny, got it.


 No.805073>>805078


 No.805078

>>805073

:-_DDD


 No.805079>>805081


 No.805081>>805083

>>805079

sure but it will give you terrible results if not properly used.


 No.805083>>805084

>>805081

How do you use it properly oh great number wizard?


 No.805084

>>805083

by choosing good constants and using a good output function

http://www.pcg-random.org/download.html

a pcg is just an lcg with a permutation applied to the output


 No.805146

>>804982


#!/usr/bin/ruby
##(c) Peter Nornig

def n(nigger) Integer(nigger) rescue false end
def f(nigger) Float(nigger) rescue false end
def atom(nigger)
if ((n = n(nigger)) != false)
return n
elsif((n = f(nigger)) != false)
return n
end
return nigger
end
def read_from_niggers(niggers)
if (niggers.length == 0) then raise "unexpected EOF" end
nigger = niggers.shift
if ('(' == nigger)
l = []
while(niggers[0] != ')')
l.push(read_from_niggers(niggers))
end
niggers.shift
return l
elsif(')' == nigger)
raise "unexpected"
else
return atom(nigger)
end
end
def niggerize(ln) ln.gsub('(', ' ( ').gsub(')', ' ) ').split end
def gibs(prog) read_from_niggers(niggerize(prog)) end
def dyad(sym) lambda{|x,y| x.send(sym.to_sym, y)} end
def standard_ghetto
ghetto = {}
['+','-','*','/','<','>','<=','>='].each{ |s| ghetto[s] = dyad(s) }
ghetto['='] = dyad('==')
ghetto['tits'] = lambda {|x| x[0] }
ghetto['ass'] = lambda {|x| x[1..-1] }
ghetto['gibs'] = lambda {|x,y| [x] + y }
ghetto['aintnothin?'] = lambda {|x| x == []}
ghetto['hey-yo'] = lambda {|*x| x[-1]}
ghetto['yaboys'] = lambda {|*x| Array(x) }
ghetto['bigz'] = lambda {|x| x.length }
return ghetto
end
class Proced
def initialize(gibsmedat, booty, ghetto)
@gibsmedat = gibsmedat
@booty = booty
@ghetto = ghetto
end
def call(*args)
@gibsmedat.zip(args).each{|p,a| @ghetto[p] = a} ##set args as param vals
return we_wuz(@booty, @ghetto)
end
end

$global_ghetto = standard_ghetto()
def we_wuz(x, ghetto = $global_ghetto)
if x.instance_of?(String) #symbol
return ghetto[x]
elsif(x.instance_of?(Integer) or x.instance_of?(Float)) #constant literal
return x
elsif(x[0] == 'if')
(_, test, conseq, alt) = x
exp = (if we_wuz(test, ghetto) then conseq else alt end)
return we_wuz(exp, ghetto)
elsif(x[0] == 'we-wuz')
(_, var, exp) = x
ghetto[var] = we_wuz(exp, ghetto)
elsif(x[0] == 'niglet')
(_, gibsmedat, booty) = x
return Proced.new(gibsmedat, booty, ghetto) #ghetto scope
elsif(x[0] == 'quote')
(_, exp) = x
return exp
else
pro = we_wuz(x[0], ghetto)
args = x[1..-1].map{ |arg| we_wuz(arg, ghetto)}
res = pro.call(*args)
return res
end
return nil
end

def niglipstr(exp)
if exp.instance_of?(Array)
return '(' + exp.map{|e| niglipstr(e)}.join(' ') + ')'
else
return exp
end
end

def repl(prompt='weeny say> ')
while true
print prompt
val = we_wuz(gibs(gets))
if (val != nil)
puts niglipstr(val)
end
end
end


 No.805346

>>805066

Thanks for the tip, maybe I'll implement tranny random numbers, or even make it user specifiable which engine to use. How much do you think poor random number generation might affect a project like this? Basically I shuffle an array of pixel indices for insertion using the PRNG and then insert data at those locations. Obviously it's not meant to be a security oriented program, but it is nice to be more secure/difficult to extract without the seed.


 No.805351>>805427 >>805442

>>804891

Fine, you autist.


List::List(){
head = NULL;
current = NULL;
size = 0;
}

void List::push(int x){
if(head == NULL){
head = new Node;
head->val = x;
size++;
current = head;
return;
}

current = head;
while(current->next != NULL)
current = current->next;
current->next = new Node;
current->next->val = x;
size++;
return;
}

bool List::pop(int x){
if(head->val == x && head->next != NULL){
head = head->next;
size--;
return 1;
}
if(head == NULL)
return 0;

current = head;

while(current->next != NULL){
if(current->next->val == x){
current->next = current->next->next;
size--;
return 1;
}
else if(current->val == x){
delete current;
}
current = current->next;
}
}

//print method, do not use
void List::print(){
current = head;
while(current->next != NULL){
std::cout << current->val << ", ";
current = current->next;
}
std::cout << current->val;
current = head;
return;
}

int List::getSize(){
return size;
}

bool List::exists(int x){
current = head;

if(x == head->val)
return 1;
while(current->next != NULL){
if(x == current->val){
return 1;
}
current = current->next;
}
return 0;
}

As I said, it's shit. I did it last minute and could likely re-write it better in several places. The end product ended up leaving fields as public because it was easier to work with that way, so some of the methods are unused, and I made the minimal amount of methods to get it working for the assignment. It's not a complete re-implementation of a List class found in the standard library.


 No.805427>>810630

>>805351

What is an intended use of this list that would not be better served by a multiset?


 No.805442>>805446 >>805487

File (hide): de5aa86aafc5985⋯.jpg (22.43 KB, 493x514, 493:514, 12440121915.jpg) (h) (u)

>>805351

>if head == NULL

>if head != NULL

don't do this. also don't use NULL, C++11 uses nullptr instead if you have to.


 No.805446>>805516

>>805442

That's your complaint about this code? Something that utterly superficial?


 No.805487

>>805442

Thanks. Didn't know that. Previously only have c experience and we always used NULL.


 No.805516>>805519 >>805524

>>805446

the code is shit from beginning to end but i don't feel like reviewing it. the null thing is easy to point out.

why don't you review it properly instead of shitposting you faggot?


 No.805519

>>805516

I knew it was bad, but now you're just hurting my feelings.


 No.805523>>805670

>>804887

How is it bad?


 No.805524

>>805516

My fetid cock is slithering around near your asshole and is preparing to undertake a process which may result in the creation of the much-desired, legendary Feces Soup. Yes, it is true, my cock shall spew forth sticky goodies upon every clump of rancid, pinworm-infested feces concealed by the depths of your rectum. It will be a feces fiesta inside your ass as my tadpoles penetrate and violate every heap of feces in sight, producing the aforementioned mythical, delectable substance.

What say you?


 No.805670

>>805523

Yeah, I'd actually like to know how specifically it's bad so I can fix it. I didn't post my code so I could try to claim non-pajeet status or brag about my sick coding skills. I know I'm not good, but I want to get better.


 No.805696

File (hide): 018eb983e7c02d6⋯.jpg (70.24 KB, 800x762, 400:381, flat,800x800,070,f.u4.jpg) (h) (u)

>>793155

/myguy/


 No.805716>>805745 >>805793

>What are you working on, /tech/?

Learning openGL. Made a made a mesh class.

r8 my cube


 No.805745

>>805716

That's a pretty sexy cube.


 No.805746>>806664

doing some assembly for the C64, I want to create a tape based OS, obviously I'm going to be working with the character ROM and KERNAL since that's also mostly in ROM anyways, its basically like BIOS calls in a standard PC. the OS will basically be centered around a custom cassette tape based filesystem using datasette subroutines, there will be a space in memory at the beginning of the tape for filesystem metadata so right away you can browse the system, but file access will naturally still be slow as fuck

For some fucking reason its impossible to remove the "READY" prompt without this "hack", not even the code snippets online worked for some reason


processor 6502
org $1000 ;start address
lda #0
sta $d020
sta $d021
JSR $E544
sta $D3 ;move cursor to row 0
sta $D6 ;move cursor to colum 0
lda #5
sta $0286
rts


 No.805793

>>805716

vere iz ze code Louis?


 No.806084>>806104 >>806144

New and improved list


class List
{
public:
List() :
head(nullptr),
list_length(0)
{}

~List() {
delete_all();
}

void add(int value) {
if (!head) {
head = new Node(value);
++list_length;
return;
}

Node* node = traverse();
node->set_next(new Node(value));
++list_length;
}

void print_all() {
if (!head) {
return;
}

Node* node = head;
while (node->get_next()) {
std::cout << node->get() << " ";
node = node->get_next();
}
std::cout << node->get() << " ";
}

void set(int pos, int value) {
Node* node = traverse(pos);

if (!node) {
return;
}

node->set(value);
}

int get(int pos) {
Node* node = traverse(pos);

if (node) {
return node->get();
}

return 0;
}

void insert(int pos, int value) {
Node* current_node = nullptr;

if (pos > list_length) {
pos = list_length;
}

if (pos <= 0) {
current_node = head;
}
else {
current_node = traverse(pos);
}

if (!current_node) {
return;
}

// save its successor
Node* successor = current_node->get_next();

// insert new node and copy value of current node into it
current_node->set_next(new Node(current_node->get()));

// set the successor node of our new node
current_node->get_next()->set_next(successor);

current_node->set(value);

++list_length;
}

void delete_at(int pos) {
// go to node before the one we want to delete
Node* current_node = traverse(pos - 1);

if (!current_node) {
return;
}

// get successor of node we want to delete
Node* successor = current_node->get_next()->get_next();

delete current_node->get_next();

// repair link
current_node->set_next(successor);

--list_length;
}

void delete_all() {
if (!head) {
return;
}

Node* node = head;
while (node->get_next()) {
Node* delete_this = node;
node = node->get_next();
delete delete_this;
}

head = nullptr;
list_length = 0;
}

private:
Node* traverse(int pos = -1) {
if (!head) {
return nullptr;
}

Node* node = head;
int i = 0;
while (node->get_next()) {
if (pos >= 0 && i == pos) {
break;
}
++i;
node = node->get_next();
}
return node;
}

Node* head;
int list_length;
};


 No.806085>>806128

roll


 No.806092>>806097 >>806099

would anyone here audit some code in exchange for money?


 No.806095

File (hide): 114e9590da56186⋯.png (109.66 KB, 286x217, 286:217, 1468095421068.png) (h) (u)

>wanting /tech/ to audit your code


 No.806097

>>806092

I charge 5000 rupees per line.


 No.806099

>>806092

only if it is rust code


 No.806104>>806124

>>806084

delete all doesn't delete the last element


 No.806124

>>806104

Already fixed, will be rolled out on patch tuesday.


 No.806128

>>806085

Fucking frameworks, I don't want to fuck around with installing dependencies and hunting correct versions, reroll.


 No.806144>>806156

>>806084

>add function traverses the whole list

why???????

>print_all

>set

>get

doesnt c++ have iterators?????

>delete_all

lol. rust does this automatically

https://play.rust-lang.org/?gist=47b9e5a7fae6774990fa8ab7a552cecc&version=stable


 No.806156>>806158 >>806160

File (hide): 3d28237ebd69a02⋯.png (67.87 KB, 540x300, 9:5, 1487931191892.png) (h) (u)

>>806144

Is this bait?


 No.806158

>>806156

no????? why do you ask?


 No.806159

roll


 No.806160

>>806156

If you have to ask...


 No.806664

File (hide): 08498eed514315c⋯.gif (1.91 MB, 370x256, 185:128, my sex life.gif) (h) (u)

>>805746

Honestly I bet it'd be easier if you created your own cartridge as when the cart is loaded in BASIC isn't even loaded into memory but I think the character ROM is.

Also that's some weird assembly there. Off of the top of my head you're setting the background color to black, running whatever the hell is at E544 (probably a kernal function seeing as though it's near the end of mem). Then you are moving 05 to address 0286 which is the current character color code. If that's 05 then READY. is actually still in your screen memory? (I think that starts from 0400)

I hope I'm not misunderstanding here as I don't have a datasette. Maybe you're talking about how after loading in data it says READY. but that only happens when the BASIC interpreter is loaded into memory. If you just load in the data yourself using the kernal functions you can do this without any output.


 No.806901>>806906 >>806910 >>806928 >>806949

If your function takes a lot of parameters, would it be better to pass an object into it rather than all the values separately? What's the difference in terms of what's happening on the inside, is one of them more efficient than the other?

function(a, b, c, d, e, f, g, h, i, j, k, l, m){
log(a, b, c, d, e, f, g, h, i, j, k, l, m);
}

function(me){
log(me.a, me.b, me.c, me.d, me.e, me.f, me.g, me.h, me.i, me.j, me.k, me.l, me.m);
}


 No.806906>>806924

>>806901

which language?


 No.806910>>806924

>>806901

Rethink your design, this is not good design.


 No.806924

>>806906

C, though I'd like to know this about other languages too.

>>806910

Can't get around it.


 No.806928

>>806901

Yeah people use structs/objects to solve this issue. But only if the arguments are related.


 No.806949

>>806901

Your former case is special because the function can jump to or alias `log'.

If you're using a lot of these arguments and passing them down through multiple layers like this, consider passing a pointer-to-struct instead.


 No.807413>>807419 >>807475

why does the commented code produce the correct result but the function doesn't?

[code]

function set(a,b,c,d){

if(a===b){

c = d;

console.log(a,b,c,d);

}

}

function initalA(array){

for (var i in array){

set(array[i].nationality,"Brit",array[i].house,"red");

// if (array[i].nationality === "Brit"){

// array[i].house = "red";

// }

// else if (array[i].nationality !== "Brit") {

// var index = array[i].house.indexOf("red");

// array[i].house.splice(index,1);

// console.log(array[i].house);

// }

}

}

[code]


 No.807418

Rolling.


 No.807419>>807444

>>807413

Function arguments in javascript are passed by value.


 No.807444>>807446

>>807419

thanks, i used [ ] instead of do syntax and it worked


 No.807446

>>807444

Yeah, the array works a bit differently because the elements are stored as references. The array object argument is copied into the function parameter, but it's not a deep-copy.


 No.807475>>807477 >>807499

>>807413

Don't use "i in array" or you're going to have a bad time.


 No.807477>>807499

>>807475

Javascript is such a steaming pile of shit.


 No.807499>>807610

>>807475

>>807477

for..of fixes the problem, but it's new enough not to be supported in some browsers.

There's many newer js features like that which make it a little nicer to use but they're all still experimental or have bad browser support.


 No.807610>>807632

>>807499

Which results in more kludges where the code has to determine what functions in can call, ultimately no better than conditional-ridden C code.


 No.807632

>>807610

Don't remind me. I have to do all kinds of retarded convoluted shit at work to accomplish simple tasks, just because some fucking iphone somewhere doesn't support a feature that's been supported by all major browsers for 6 years and a client complained about it. If I was the boss I'd tell them to shove their ipad or whatever up their ass, but I'm not so I just have to make it work even if I have to replace the page with an image.


 No.808126

File (hide): 1309ae39fe3dfbb⋯.png (217.38 KB, 386x339, 386:339, out.png) (h) (u)

rolling


 No.808322

rollan


 No.808516>>808524

So whats a good compiler. I've been experimenting with clang, aside from GNU or the shit that comes with windows, I don't know any compilers. Do they have significant differences between them for how fast your program will run? Is it just meme magic?


 No.808524

>>808516

GCC and Clang both work fine for you. Once you're an expert, you can look into the technical differences. Until then, the most overt difference you'll notice is the licensing, but it doesn't matter so much for end users. The other difference is that Stallman is pretty weird about exporting the AST, fearing that it could be used by "nonfree" backends.


 No.808630>>808632

>>793034 (OP)

Let's rock n' roll boiz XD


 No.808631>>809084

>>793034 (OP)

Rolling.

We need new challenges though...


 No.808632>>808634 >>809264

>>808630

Alright IP obscuration here we come. I will post the finished results by October 24th 20:00 JST


 No.808634

>>808632

If I don't ban me and call me a cuckold faggot who will be flayed and publicly displayed on the day of the rope.


 No.808637

>>793332

>GTK

>GIMP Tool Kit

>GNU Image Manipulation Program Tool Kit

>GNU Not Unix Image Manipulation Program Tool Kit

>???

>repeat


 No.809084

>>808631

Have you seriously done most of these? Considering the difficulty, it would take someone with significant dedication at least a year (probably way more) to do them all.


 No.809143

>>793034 (OP)

roll


 No.809264>>809265

>>808632

https://github.com/yooow0t/url-obscurification/blob/master/README.md

Done. I may add tests later and do more documentation as I become more familiar with git.

Rool


 No.809265>>810289

>>809264

Wew depressingly easy.

26th of October 01:00 JST

Better link: https://github.com/yooow0t/url-obscurification


 No.810289>>810290

>>809265

Done. 9 methods of encoding but, no decoding. I fucked up and tried to make everything super generalised right from the get go instead of doing the base case and then refactoring. The whole thing is a mess.

https://github.com/yooow0t/message-encoder

Rolling again


 No.810290>>810298 >>815584

>>810289

Best give me a fortnight for this.

What luck, I'm reading through SICP anyway so that works out great.


 No.810298>>810756

>>810290

did you try the challenge from the challenge thread yet?


 No.810531

>>793034 (OP)

I'm attempting to write a slackware package manager for fun but i have nobody to test it and tell me if it's still fucked because my slackware machine is fucked


 No.810630

>>805427

The purpose was an assignment. I'm also a beginner.


 No.810756

>>810298

No not yet but, I might


 No.811247

Currently scraping myanimelist for rating data to build a recommender system off of. ~4.2 million users, ~200m individual ratings. Stupid thing is at like 40GB in the db, and the damned primary key index is like 50% the size of the data itself

Currently still researching recommender systems to see how to approach though. Probably gonna be word2vec or collaborative filtering, because im particularly interested in returning nearest user in taste in the corpus.

Might try to see if I can incorporate tag based recommendation by using animedb as well

Problem is it's probably gonna take ages to go through so many records with my available compute power...


 No.812035

Anyone here familiar with F#? How can I generically turn this (probably invalid) JSON:


[
{
filter : {
subject : "foo"
},
action : {
assign_to : "bar"
}
},
{
filter : {
author : "foo"
},
action : {
status : "bar"
}
}
]

into this (pseudocode):


match ticket with
{subject="foo"} -> updateticket(assign_to="bar")
{author="foo"} -> updateticket(set_status="bar")


 No.812152

>>793034 (OP)

roll


 No.815584

>>810290

Best give me until Nov 10th. I underestimated what would need to be done. I am nearly done writing a Scheme like interpreter in Python. It isn't easy and if you rush it you fuck up.

I didn't know any compiled languages prior to this challenge and so I am now halfway through the first chapter of K&R.

If anyone is wondering the challenge was to write an interpreter in a compiled language. While I am at it I will also be getting the LISP interpreter challenge and the RPN calculator challenge out of the way bringing the total number of challenges to 5. I am aiming for 25 before January 25th and it's starting to look like I will make it. After I finish I will roll again but, I'll also be working on a Rougelike, a C compiler and C interpreter so that'll be another 2.

I hope this thread is still around by the 25th.

My appoligies for the blog post and the reddit spacing.


 No.818297

I'm really struggling in implementing bicubic interpolation for down scaling. I'm using the equations from http://www.paulinternet.nl/?page=bicubic.

For the x and y values that are passed in, I think it is essentially the subpixel coordinates on a region that is measured from 0 to 1 that is over the kernel.

My problem is that I keep getting garbage values and I'm too new to image processing to know what could be at fault. If my x and y values aren't set to both 0 or both 1 I get weird artifacts, see pic related. If it is set to 0 / 1 the output I get is very close if not exactly nearest neighbor. I've also tried up scaling, but I got poor results with a similar style of artifacts.

x, y are the coordinates of the new image I'm working on

px, py the coordinates on the original image that are the nearest neighbor to x and y on the new image

image holds stuff related to the original image

image->color_depth is going to be 3 since we are working in RGB

image->row_pointers[][] is the image from libpng (first indexed by the row you want, then for the row every 3 values is a new pixel, since this image is just RGB)

image->width and image->height are the width and height of the original image.


double kernel[4][4];
int color[3];
for (int c = 0; c < 3; c++) {
for (int kx = 0; kx < 4; kx++) {
for (int ky = 0; ky < 4; ky++) {
kernel[kx][ky] = ((double) image->row_pointers[min(py + ky, image->height - 1)][min(px + (kx * image->color_depth), image->width * image->color_depth - image->color_depth) + c]);
}
}
color[c] = bicubicInterpolate(kernel, 0.5, 0.5);
}

So for each x and y value of my image, I build a 4x4 kernel and then run the bicubicInterpolate function on it. I do that for each of the three color channels and then I write that color to the x and y coordinates.

I'm probably doing stuff very wrong, but hopefully I am not too far off from getting it working. I'm also open to receiving more resources on how to properly implement it.


 No.818529>>818823

What sort of things should I develop that will impress employers? I don’t want to say “absolute minimum”, but somewhere in that ballpark would be nice.


 No.818557

r o l l


 No.818646>>818678

What do people use to compare disassembly with source code when programming in C? Particularly comparing changes when you are optimizing.

Do people just objdump or something?


 No.818648>>818754

I thought I'd learn programming by finding exercises online and asking Stack Exchange how to do certain things, but I have a habit I'm going to run into bad habits along the way.

Here's a program that will calculate in which year you will be 100 years old. I also happen to simultaneously be learning german.

from datetime import date

def jahrhundert(jahr):
jetzt=date.today().year
letzt=jetzt-jahr
hundert=letzt+100
return hundert


name=raw_input("Was ist dein Name?\n")
jahre=input("Danke, dann wie alt bist du?\n")
hundertjahr=str(jahrhundert(jahre))

print "In der Jahr "+hundertjahr+", du wirst hundert Jahre alt sein."

I don't even like Python as a language for learning. It feels like advanced Excel hacking.


 No.818678>>818734

>>818646

They don't


 No.818707>>818821

Hi, /tech/.

I have few years of experience programming things. Until now I mostly focused on learning how to compute things. Now I want to create something that would help people.

What is best way to start making GUIs?

>inb4 electron applications


 No.818734

>>818678

Do they just guess what the compiler is doing?


 No.818754>>818772

File (hide): 905757a75c0a74c⋯.jpg (116.98 KB, 400x548, 100:137, 12346891929841.jpg) (h) (u)

>>818648

>in der jahr du wirst hundert jahre alt sein

Deutsch ist schon ne schwere Sprache hmm?


 No.818772

>>818754

I never said that I spent much time studying it.

Mein Brüder hat drei Katzen.

Ich habe ein Apfel gefressen.

Magst du eine Hausfrau, Herr Scheisskopf?

I can write the program again in spanish if you want.


 No.818821>>818822

>>818707

Use Qt (Pronounced cute). Documentation is great Lately been working with raw Xlib whose documentation is pretty bad.

It's pretty straight forward to use and I was able to pick it up and use it for a project easily.

Note that Qt is primarily for C++.


 No.818822>>818837

>>818821

Thank you for replying to my message. I have some additional questions now.

Can you please tell me more about your setup for creating programs with Qt?

Is QtCreator worth learning? Should I use Qt Widgets or Qt Quick?


 No.818823

>>818529

Ransomware which is only resolved if they hire you.


 No.818837

>>818822

>Can you please tell me more about your setup for creating programs with Qt?

It's nothing special, just the same as any other program. They do offer their own IDE which comes with a GUI builder if that's your thing.

>Is QtCreator worth learning?

It's not for me, but feel free to try it out.

>Should I use Qt Widgets or Qt Quick?

Use Qt Widgets. Qt Quick is similar to electron from what I've heard.


 No.818978>>818990 >>818998 >>819014

>heh there's a need for a short-lived script to run on a few thousand computers

>I'll just use lua for this

<http://www.lua.org/pil/1.4.html

<LUA_INIT environment variable

NEVER

FUCKING

MIND

It's like they sat down and said "what can we add that will make this language unusable by sysadmins?"


 No.818990>>818996

>>818978

how does setting an envar to do something with an interperter make it unusable? Python can set like, 15 different envars id you let it.


 No.818996

>>818990

write a script to do something as root, for users. a good example would be a script that updates an nginx config for a user's site, while checking it for 'bad stuff'.

In order for the script to run as root, but be callable by a user, you could A) have a server, like cPanel, or B) let the user directly call the script, with the script setuid: although a normal user invoked it, the script will run as root.

setuid scripts are always delicate. There used to be a race condition inherent in using a script at all. There are lots of environmental issues that need to be considered, like a malicious PATH. a serious language like Perl gives you a number of tools. Lua gives you LUA_INIT which means that any setuid lua script, ever, is a gaping security hole. Because a user can just set that variable to a script that a setuid lua script will run as root.

Of course you can fork lua.c and drop the 'feature', but I considered lua in the first place because lua was already on the farm and could just be used as-is.

$ cat hello.lua 
print("Hello, world!")
os.exit(42)
$ LUA_INIT=@hello.lua luajit -e 'print("do something else")'
Hello, world!


 No.818998

>>818978

to be clear I don't need a setuid script for this. But I don't feel comfortable using Lua at all in a sysadmin context because it might encourage someone, later on, to use Lua for a setuid script. sysadmins often use technologies without being complete experts in them. Rather than require everyone to be an expert, I prefer to use technologies that tend to fail safely rather than dangerously.


 No.819014>>819042

>>818978

If you don't like LUA_INIT, why don't you just compile a build without it?


 No.819042

>>819014

I'm not that anon, but I'd not use it for that reason, too. And I don't want to build software I can't deploy on a standard system - I'm not ok with having to tell users they need to maintain their own version of lua to not get owned while using my stuff.


 No.819820>>819826 >>825547

The last few weekends I've been making a 8chan browser terminal application. Right now it's pretty basic. You hardcode the url of a thread's json into the main function and then it downloads the page and then downloads all of the images. Then it parses each image as a png, (I haven't gotten around to adding support for other image formats). Once all the data it needs has been downloaded, it prints out all the posts and images. The images are resized to be 10 lines tall using bicubic interpolation. Just over this past weekend I've added support for scrolling. You can use C-p and C-n to scroll up or scroll down through the thread. It even supports redrawing the images when leaving and enter fullscreen, along with when you switch work spaces.

It's been a great learning experience working with some of the intricacies of the terminal.

I do have a question through for you guys. When I implemented 'c' for printing out the GPLv3 license like I'm supposed to it doesn't seem to be able to print the whole thing. It's like I'm overwhelming stdout or something. Even with flushing after every single output, it does not seem to be enough and I have to add 1 second delays in order to guarantee the whole thing being printed. I even tried with half a second delay and it wasn't consistently printing out the whole thing. Do you think it might have to do with me splitting the license into 4095 characters strings?


 No.819826>>819836

>>819820

your printing story is crazy. doesn't make any sense. try stracing the program and seeing what's up. You can do that in another terminal with 'strace -p $pid', or you can pipe stderr to a file: 'strace hatechan-browser 2>browse.log'


 No.819836>>820576

>>819826

While cleaning up some of the spam that I was seeing in strace IIRC it's possible to be more picky with what you want to output, but I'm lazy. I figured out what was indirectly causing it.

fcntl(STDIN_FILENO, F_SETFL, fcntl(STDIN_FILENO, F_GETFL) | O_NONBLOCK);

I'm using this so that in my mainloop so that getchar() doesn't block so I can do other things like update images. I'm not too sure why this would cause that, but I'll poke around tomorrow.


 No.820576>>820577 >>820729

>>819836

This seems to actually be the direct cause of my problem.


sleep(1);
//fcntl(STDIN_FILENO, F_SETFL, fcntl(STDIN_FILENO, F_GETFL) & ~O_NONBLOCK);
for (int i = 0; i < sizeof(copying) / sizeof(char *); i++) {
printf(copying[i]);
fflush(stdout);
}
sleep(1);

If the line above that is currently commented is uncommented it works just fine, else it just stops part way through and the terminal refuses to print out any more of it. It's pretty weird, but I think I'll just set stdin to be blocking while it's printing it out and then set it back to nonblocking after it finishes.


 No.820577

>>820576

Another weird thing I found out is that even though it wouldn't work if I ran it normally, if I piped in the command to print it out, the whole thing is printed out.

Perhaps it is a weird bug with (u)xterm since it only appears to happen when stdin is terminal input instead of from a pipe.


 No.820729>>821435

>>820576

My C/C++ is a bit rusty, but shouldn't it be printf("%c", copying[i]) or printf("%s", copying) or something similar?


 No.821435

>>820729

Honestly it should, but since my strings are constants and not based on user input they should be fine.

I'll change it anyways since it's good practice.


 No.821864

Not doing a programming course but I'm doing basic geodetic calcs and have been trying to rewrite parts of the spreadsheets we idiotically punch numbers into in VBScript, just because they're much more flexible as functions, and it explains what's happening. That's been partially successful but I'd rather an alternative framework like GNU Octave, and want advice on that. It has to be something I can use quickly, compiled languages are no-go.

Also just because, the bit for angle conversion. It's ugly to work with but I know my implementation could be much better and I'll probably need to write one regardless of framework as it seems uncommon.

' Main Decimal Degrees to DMS
Function DDD2DMS(B As Double) As DMS
Dim X As Double
Dim Enc As DMS
Enc.Sign = Sgn(B)
B = Abs(B)
Enc.D = Int(B)
X = (B - Enc.D) * 60
Enc.M = Int(X)
Enc.S = (X - Enc.M) * 60
DDD2DMS = Enc
End Function

' Main DMS to Decimal Degrees
Function DMS2DDD(Sign As Integer, D As Integer, M As Integer, S As Double) As Double
DMS2DDD = Sign * (Abs(D) + Abs(M/60) + Abs(S/3600))
End Function

' Read in DMS value (format DDD.MMSSssssss)
Function DMSE2DDD(B As Double) As Double
Dim Enc As DMS
Dim X As String
Enc.Sign = Sgn(B)
X = Format(Abs(B), "000.0000000000")
Enc.D = Val(Left(X, 3))
Enc.M = Val(Mid(X, 5, 2))
Enc.S = Val(Mid(X, 7, 2) & "." & Right(X, 6))
DMSE2DDD = DMS2DDD(Enc.Sign, Enc.D, Enc.M, Enc.S)
End Function


 No.821879>>821881

roll


 No.821881

>>821879

ah fuck me


 No.825494>>836091

Can someone help me find a blogpost? It's satire where someone designs a ForLoop library that has semantics along the lines of ForLoop.create(); ForLoop.setInitialization(i = 0); ForLoop.setCondition(i<max); ForLoop.setIteration(i++); ForLoop.setBody(sum += array[i]); ForLoop.run(); and then compares this to the argument parser library in MATLAB (or R, my memory is hazy), and the point is that dedicated syntax for common patterns is useful in a language, and is much better than object-oriented library syntax. For the life of me, I can't find it, because whenever I search "for loop library" I get bombarded with Java and C# explanations of for loops.

inb4 "not programming


 No.825522>>825530

Best programming language to learn for cross-platform (Linux, windows, mac, maybe android too) standalone executables in the coming decade? New to programming but that would be my ideal language.


 No.825530


 No.825547>>825959

>>819820

Is there a repo? You should make the GUI backend pluggable. I want to create a GTK+ backend for your program.


 No.825600>>825602 >>825604

Bezier anon here. I did a small GTK demonstration to test my bezier algo. r8. You can change the points[] array to any set of x,y between 0 and 1 to test it.

#include <math.h>

#include <gtk/gtk.h>
#include <cairo.h>

struct point {
double x;
double y;
};

int
/**
* Calculates factorial. (recursive)
*
* @param n Number to factor
*/
fact(int n) {
if (n <= 1) return 1;
else return n*fact(n-1);
}

int
/**
* Calculates the binomial coefficient based on n and k.
*
* @param n Binome degree
* @param k Binome step
*/
binom(int n, int k) {
return fact(n)/(fact(k)*fact(n-k));
}

void
/**
* Calculates the point on the bezier curve for t, based on points.
* The result is saved to out.
*
* @param t The percentage of the point to calculate. 0 <= t <= 1
* @param points Array of `struct point`s.
* @param npoints Count of points in the points array.
* @param out The `struct point` to save the results to.
*/
bezier(double t, struct point *points, int npoints, struct point *out) {
int n = npoints -1;
for (int i = 0; i < npoints; i++) {
struct point p = points[i];
double expo = binom(n, i) * pow(1.-t, n-i) * pow(t, i);

out->x += expo*p.x;
out->y += expo*p.y;
}
}

// The percentage to iterate.
static double t = 0.0;

static void
/**
* Does the drawing on the Cairo surface.
*
* @param cr Pointer to Cairo object.
* @param x The width of the GtkDrawingArea.
* @param y The height of the GtkDrawingArea.
*/
main_draw(cairo_t *cr, int x, int y) {
//struct point points[] = {{0.0, 0.0}, {0.5, 0.0}, {0.5, 1.0}, {1.0, 1.0}};
struct point points[] = {{0.0, 0.0}, {1.0, 0.0}, {1.0, 1.0}};
struct point bez;

if (t >= 1.) t = 0.0;

// Draw base points BEGIN
cairo_new_path(cr);
cairo_set_source_rgb(cr, 1., 0., 0.);
cairo_move_to(cr, (x/4)+(points[0].x*((2*x)/4)), ((3*y)/4)-(points[0].y*((2*y)/4)));

for (unsigned int i = 1; i < sizeof(points) / sizeof(*points); i++) {
cairo_line_to(cr, (x/4)+(points[i].x*((2*x)/4)),
((3*y)/4)-(points[i].y*((2*y)/4)));
}

cairo_set_line_width(cr, 3);
cairo_stroke(cr);
// Draw base points END

// Draw curve BEGIN
cairo_new_path(cr);
cairo_set_source_rgb(cr, 0., 1., 1.);

for (double i = 0.0; i <= t; i += .01) {
bezier(i, points, sizeof(points) / sizeof(*points), &bez);

cairo_line_to(cr, (x/4)+(bez.x*((2*x)/4)), ((3*y)/4)-(bez.y*((2*y)/4)));

bez.x = 0;
bez.y = 0;
}

// Debug print
bezier(t, points, sizeof(points) / sizeof(*points), &bez);
g_print("t = %.2f\n", t);
g_print("bez = {%.2f, %.2f}\n", bez.x, bez.y);

bez.x = 0;
bez.y = 0;

cairo_set_line_width(cr, 3);
cairo_stroke(cr);
// Draw curve END

// Draw animation rectangles BEGIN
struct point rect_p = {0, 0};
bezier(t, points, sizeof(points) / sizeof(*points), &rect_p);

// Vertical rect
int ry = rect_p.y*(2*y/4);

// This feels like poo-in-loo tier, is there a better method?
cairo_new_path(cr);
cairo_set_source_rgb(cr, 0,1,0);
cairo_move_to(cr, (x/4)-10, ((3*y)/4)-ry-10);
cairo_line_to(cr, (x/4)+10, ((3*y)/4)-ry-10);
cairo_line_to(cr, (x/4)+10, ((3*y)/4)-ry+10);
cairo_line_to(cr, (x/4)-10, ((3*y)/4)-ry+10);
cairo_close_path(cr);

cairo_fill(cr);

// Horizontal rect
int rx = rect_p.x*(2*x/4);

cairo_new_path(cr);
cairo_set_source_rgb(cr, 0,0,1);
cairo_move_to(cr, (x/4)+rx-10, (y/4)-10);
cairo_line_to(cr, (x/4)+rx+10, (y/4)-10);
cairo_line_to(cr, (x/4)+rx+10, (y/4)+10);
cairo_line_to(cr, (x/4)+rx-10, (y/4)+10);
cairo_close_path(cr);

cairo_fill(cr);
// Draw animation rectangles BEGIN
}

1/2


 No.825602>>825604

>>825600

static gboolean
/**
* Handles the draw event of the GtkDrawingArea.
* Just calls the main_draw method with the widget's width/height.
*
* @param area GtkDrawingArea widget
* @param cr Cairo object passed by GTK+
* @param data Unused
*/
main_ondraw(GtkWidget *area, cairo_t *cr, gpointer data) {
(void) data;
main_draw(cr, gtk_widget_get_allocated_width(area),
gtk_widget_get_allocated_height(area));
return TRUE;
}

static gboolean
/**
* Queues a new draw every 1/60s. Also increases t.
* t is increased here instead of main_draw so redraws outside of this don't
* affect the t value.
*
* @param data GtkDrawingArea object as gpointer
*/
draw_tick(gpointer data) {
gtk_widget_queue_draw(GTK_WIDGET(data));
t += 0.01;
return TRUE;
}

int
/* Main function, GTK event loop. */
main(int argc, char **argv) {
GtkWidget
*window,
*darea;

gtk_init(&argc, &argv);

window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
darea = gtk_drawing_area_new();

gtk_window_set_default_size(GTK_WINDOW(window), 300, 300);
//gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
gtk_window_set_title(GTK_WINDOW(window), "Bezier");

gtk_container_add(GTK_CONTAINER(window), darea);

g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
n_ondraw), NULL);
g_timeout_add(1000/60, (GSourceFunc) draw_tick, darea);

gtk_widget_show_all(window);

gtk_main();

return 0;
}

2/2


 No.825604

>>825602

>>825600

Compile with:

gcc bezier.c -o bezier -O3 -ffast-math -funroll-loops -ftree-vectorize -Wall -Wextra -Werror -pedantic -std=c99 `pkg-config --cflags --libs gtk+-3.0 cairo` -lm


 No.825743

In Shell


for i in $input
do
blah blah command $i
sleep 1
done

Someone please show me how to replicate this simple shit in Python, Perl, Ruby or any scripting language. Without creating hordes of zombie process. Because I fucking give up.


 No.825959>>826292 >>828706

>>825547

There's no public repo at the moment. I might make a gitgud repo in the future. I might make it after finishing porting the graphics code to use ncurses instead of my own custom terminal handler I made for it.

Right now it only support xterms for images, but it probably wouldn't be that hard to port it to work in another terminal.


 No.826292>>826316

>>825959

meep meep just use w3m's terminal image viewer tbh


 No.826316

>>826292

It's a little to bloated for my liking. Making it myself allows me to easily cache the pixmap I am creating. w3mimacedisplay can also only open image files where mine can open images from a buffer. My images also persist when switching workspaces and back.

It's actually pretty easy to implement. The hardest part was making bicubic interpolation so that my images are always 10 lines tall.

Using w3mimgdisplay would impose several logistic problems.


 No.826325>>826326 >>826336 >>826374 >>826403 >>827170 >>827178 >>835926

File (hide): c69c7b0e9825b0b⋯.png (53.94 KB, 472x310, 236:155, c69.png) (h) (u)

Is there a language that allows you to define variables as arbitrary number of bytes, and then do whatever the fuck you want with them without it complaining that you're doing it wrong?

For example


foo[2]; //foo is 00000000 00000000
foo = 1234; //foo is 00000100 11010010
foo = "op"; //foo is 01101111 01110000
foo = 6346335; //foo is 11010110 01011111; 1100000 was omitted from the front because there was no space for it

bar[1024]; //bar is 1024 bytes long
bar += 2; //bar is 10 with 1022 zeros in front

foo = bar; //foo is 00000000 00000010

bar << 100; //foo is 922 zeros, a 10, and then 100 zeros again


 No.826326

>>826325

Fuck, actually "bar" would be 8192 zeros


 No.826336>>826367

>>826325

Try searching for multiprecision or arbitrary precision then look

If you don't mind it not being built into the language, you could use GMP.


 No.826367

>>826336

I'd prefer if it was part of the language so I don't have to deal with overly verbose shit from a library or send things to functions just to do basic operations.


 No.826374>>827170

>>826325

You might be able to do something like that with unions in C.


#include <stdio.h>
#include <stdlib.h>
union type{

char *info;
long long inf;

};
int main(){
union type t;
t.inf = 100000;
t.info = malloc(1024);
t.info = "op";
printf("%s", t.info);
t.inf << 2;
printf("%s", t.info);
}


 No.826403>>826416

>>826325

No because that's not how machines work.


 No.826416>>826434

>>826403

It is possible. What part do you not understand?

All of the things he was suggesting are possible, I just don't think a language has all of it built in.


 No.826434>>826448

>>826416

>arbitrary

>do whatever you want

No anon that's clearly not possible.


 No.826448>>826460

>>826434

Yes, the size of the data is limited by the amount of RAM that you have. If we assume that we are not bounded by a limited amount of RAM, our data can be as big as we want.


 No.826460>>826595

>>826448

Ok you assume that. I'll stick with machines being finite. May the best anon win.


 No.826595

>>826460

Are you one of those turbo autists who think that when someone says "anything" it literally includes everything from growing wings out of your ass and telling the future with a cup of coffee?


 No.826738>>827174

File (hide): 5a0ff92ea5b64fc⋯.webm (1.04 MB, 960x600, 8:5, basicapp.webm) (h) (u) [play once] [loop]

I worked on the UI lib i'm doing some more. It's not compilable as a full shared lib yet but it's one .c + one .h file. Have a vid of it in action. It supports grouped and sequenced animations, and for now it supports position and opacity animations.


 No.827170

>>826374

>>826325

upon further review, I belive that void pointers and casting is your best bet


 No.827174>>828702

>>826738

>desktop environment

>rotation transition

>transparent terminal

>floating wm

>steam

100% cancer tbh


 No.827178

>>826325

No, because anything smaller than a byte will still be stored in a byte and everything larger than the standard datatypes is a bigint implementation.


 No.827659>>827778

File (hide): e07c3c418d757e9⋯.webm (1.65 MB, 1280x720, 16:9, out.webm) (h) (u) [play once] [loop]

Finished getting all my rendering stuff ported and working with ncurses. I added a small bar on the left which will eventually hold the threads you are in. Right now the whole left bar is hardcoded.

I also implemented the ability to post. It opens up emacs and you are able to type out your whole post in the comfort of an actual editor. Once you save and quit the post is posted.

I also set up key bindings so you can scroll by one line, or by a whole page.

I think next I'm going to work on getting the posting stuff actually integrated to the program. Right now it's a standalone thing. I could also work on getting it so that when new people post in a thread it will update. Another big improvement I could make is making the network requests multithreaded so I can download more than 1 image at a time. For big threads it takes a long time for it to download all the thumbnails.

Here's a video scrolling through the bottom of this thread. The flickering when scrolling by images is better in person since a blink can be faster than 33ms (1/30th of a second).


 No.827778>>827855

>>827659

how the FUCK are you displaying images in a terminal?


 No.827855

>>827778

Both the current display and window of the terminal of the application are passed in through environmental variables by default. I then open the display. After that, I get the child of my terminal window which is responsible for displaying text. The last thing to do is create a pixmap of the thumbnail, this includes running the image through bicubic scaling that I made. With everything set up, I can just use a regular X API to copy my pixmap onto the window.

In my event loop I listen to events that are fired when the window's size changes or workspace is switched, so I can redraw the image. When I scroll the image, I first clear the existing one, scroll the terminal, and then draw the image back.Unfortunately the scrolling doesn't seem to be instant, so I put a 0.25ms delay between the clear and the redraw.


 No.828144

Looks like I overestimated how long getting the multithreaded image download stuff working would take. I've never used threading stuff with C before, but it was actually really simple. I pretty much just create as many threads as images and I am using a semaphore to limit when threads can start.

For loading this thread here is some data on load times with different amount of max concurrent threads.

1: 3m 19s
4: 1m 0.315s
8: 35.456s
16: 24.093s
32: 19.610s

In the end I went with having 16 max threads. Thankfully this change makes load times for threads dramatically faster. If I wanted to make it even faster, I could draw all the text first and then download the images in the background as right now it has to download all the images before execution can continue.


 No.828593

Rolling


 No.828691


 No.828702>>828709

>>827174

>>desktop environment

It's XFCE, and it literally makes my life easier. I was a full tiling WM ricing autist once. Then I got a job. But I still have i3 on my laptop because the mouse is shit.

>>rotation transition

It's Compiz aka the best compositor you'll ever get on Linux.

>>transparent terminal

Provide an argument.

>>floating wm

See argument 1.

>>steam

I only play TF2.

>100% cancer tbh

I SEETH NOT A SEMBLANCE OF ARGVMENT


 No.828706

>>825959

Please set up a repo I'd like to take a look


 No.828709

>>828702

>Then I got a job

stopped reading right there. stop LARPing fagg0t


 No.829856>>829912

I want to learn how to make android apps. Can anyone recommend a good book or tutorial series?


 No.829912>>831438 >>833166

>>829856

Android Programming: The Big Nerd Ranch Guide

Is supposed to be good. I haven't read any of it yet but it has good reviews. Also download android studio and start looking through the samples.


 No.831438

>>829912

Thanks anon.


 No.831765

Added two new features to my board reader. It now has autoupdate. It starts out at 10 seconds and will double every time no new posts are found until it hits a maximum time of 10 minutes. It was kind of tricky to implement because I've been running on the assumption that lines started from the bottom and not in the middle of the screen or offscreen. While I was at it, I also made it so that unicode wouldn't mess up the rendering of my text boxes. Previously, unicode characters would be treated like they took up more than 1 column so certain lines would not take up the full width.

I also implemented a posting feature upon hitting enter. Right now it only supports a comment. You can't change the name / email / subject field, nor upload images.

Since the program is pretty much at the point of being able to browse a thread and let you make text posts, I think I'll try to set up a repo for the code if anyone else wants to check it out.


 No.833166

>>829912

Any prerequisites to this book?


 No.833324>>833469

Are design patterns a meme?


 No.833469

>>833324

Depends what language you're using. If you're using Java/C#, they discuss the limitations of the language and describe constructs that allow you to solve problems within those limitations. If you're using a more powerful language, it's still worth reading, although some parts will either be completely irrelevant to the language because it's not as limited, or trivial to implement in the language.


 No.834506

File (hide): 460a53407fbf4eb⋯.png (72.61 KB, 238x228, 119:114, arbuttle.png) (h) (u)

Finished most of my Garfield tribute site.

garftse.000webhostapp.com/

Source for it: gitgud.io/fuckballs/garftse


 No.834553

>>793101

If it's actually an important problem then simply use OpenCV. Feature extraction has been a thing for a while now tbh.


 No.834556>>836038


 No.835916>>836016

File (hide): c4de039d469065c⋯.png (186.51 KB, 600x600, 1:1, i11Ca75.png) (h) (u)

import weechat as w
w.register("memearrows","anon","1.0","PD","Greentext Support","","")
def buf_clr(dat, mod, mod_data, msg):
nck,txt=msg.split('\t')
if ">" in txt[0]:
return nck+'\t'+w.color('green')+txt
return msg
def snd_clr(dat, mod, mod_data, msg):
if ">" in msg[0]:
return '\x033'+msg
return msg
w.hook_modifier("weechat_print","buf_clr", "")
w.hook_modifier("input_text_for_buffer","snd_clr", "")

I wasn't really happy with any of the existing weechat >greentext scripts so I made my own.

It renders all >greentext messages in the buffer as green. It also sens >greentext messages with the green colorcode so everyone can see your >greentext even if they don't have the plugin.

It's python, set it to autoload in your weechat config folder if you like it


 No.835926

>>826325

Forth. Everything is a number. Some things are pairs of numbers - like a string: it's an address with a length. Forth gets out of the way and makes it easy to work with computers as they really are.


 No.836016

>>835916

> nck,txt=msg.split('\t')

Is that how weechat delimite nicknames from messages? It's different from the other function.

I any case, it might be a good idea to add to change it to

	nck,txt=msg.split('\t',1)

Just in case somebody pastes a tab into chat, otherwise it might try to allocate it to a 3rd variable which doesn't exist and end up eating the message.


 No.836033>>836102

gonna get a job offer from my cousin in some weeks to design and implement a small database

im still a student and thought i would learn db in school and now that im taking it noticed the professor is a massive retard and im not learning jack shit

what are some good database books to read or tutorials or anything you can recommend?


 No.836038

>>834556

because youtube embeds are botnet


 No.836091

>>825494

>ForLoop.create(); ForLoop.setInitialization(i = 0); ForLoop.setCondition(i<max); ForLoop.setIteration(i++); ForLoop.setBody(sum += array[i]); ForLoop.run();

That's funny because the C-style for loop is already like that compared to the traditional counting loops from Fortran, Algol, Basic, Pascal, Lua, OCaml, and other languages. That loop looks something like

for i = 1 to max
or
do i = 1, max
(the end is inclusive, so starting from 1 iterates max times). The traditional loop evaluates the start, end, and step expressions once before the loop starts, and this has very profound consequences.


 No.836102

>>836033

Using SQLite: Small. Fast. Reliable. Choose Any Three.

The Manga Guide to Databases


 No.836176

Would anyone be interested in the code for a web extension that redirects all requests for javascript files to a local repository?

Unfortunately, you can only install it temporarily since to become permanent, mozilla needs to sign an archive of it. Since you are maintaining your own repository there wouldn't really be a way to do it (I think).

I even made a few scripts for automatically pulling down copies of javascript.

This is different from decentaleyes because you aren't limited to the small selection that they offer you. Additionally, no remote javascript files will be executed when my extension is activated.

One misleading thing about it though is if you are using it with uMatrix, you have to enable the javascript for the site you would normally be requesting from, this creates a problem if you were to load a webpage before readding the temporary web extension.


 No.844003>>844012

I didn't actually learn programming so I'm stuck again. I have an amount of money stored as an int in a class, and I want a portion of that money to be transferred to another int in another class. Is there a more efficient way of doing that instead of going

class_a.money-=amount
class_b.money+=amount

?

I feel that's an extremely stupid thing to do but then again I don't know how to program.


 No.844012

>>844003

as far as efficiency goes, that's totally fine.

as far as handling money goes, what happens if the server KPs in between the -=amount and the +=amount ? You should handle money in a transactional manner.


 No.844373

class Point():

def __init__(self, name):
self.__connections = {}
self.__name = name


def create_connections(self, *connections):
for connection in connections:
if connection not in self.__connections:
self.__connections[connection.name] = connection
connection.connections[self.name] = self

def show_connections(self):
return list(self.connections.keys())

@property
def connections(self):
return self.__connections

@property
def name(self):
return self.__name


if __name__ == "__main__":
from queue import Queue

print("Running")
Point_A = Point("A")
Point_B = Point("B")
Point_C = Point("C")
Point_D = Point("D")
Point_E = Point("E")
Point_F = Point("F")
Point_G = Point("G")
Point_A.create_connections(Point_B, Point_C)
Point_D.create_connections(Point_C, Point_F)
Point_E.create_connections(Point_B, Point_G)
Point_G.create_connections(Point_F)

print("Point A", Point_A.show_connections())
print("Point B", Point_B.show_connections())
print("Point C", Point_C.show_connections())
print("Point D", Point_D.show_connections())
print("Point E", Point_E.show_connections())

frontier = Queue()
frontier.put(Point_A)
came_from = {}
came_from[Point_A] = None

while not frontier.empty():
current = frontier.get()
for next in current.connections.values():
if next not in came_from:
frontier.put(next)
came_from[next] = current

current = Point_F
path = []
while current != Point_A:
path.append(current.name)
current = came_from[current]
path.append(Point_A.name)
path.reverse()

print(path)

I was simply wondering if there was a better way to write this code, specially the way i handled the objects names. I believe there is nothing wrong with the pathfinding, mostly because i copied it from https://www.redblobgames.com/pathfinding/a-star/introduction.html


 No.844595>>845001

Im working on a program tjat simulates a solar system. The only problem is is that I cant figure out how to simulate the flow of time without a massive for loop.


 No.845001

>>844595

Set up a repeating timer and update your world with delta time = interval between the two last ticks. Or if it's a graphical program, you could do the updates in the frame loop.


 No.845160

Is it possible to get a programming job with just a 2 year degree or am I just wasting my time applying for jobs?


 No.845902>>845905 >>845913 >>845932 >>845964

File (hide): 9916a7460e70a00⋯.png (293.25 KB, 930x524, 465:262, Nichijou 05-620x.png) (h) (u)

i-i made a shitty image board with lynxchan

http://badplanchan.net

pls don't b-bully


 No.845905

>>845902

I am not going to fill out a captcha for every single fucking post.


 No.845913

>>845902

>Error

>500

>TOR users are blocked.

Aaaaaaand into the garbage it goes. 8chan allows Tor posting without images. Mewch, Endchan, and a number of other minor chans allow Tor posting with images. There's really no excuse for an altchan not to allow Tor.


 No.845932

>>845902

I like the name.


 No.845949>>846724

Finished my lemonbar script (really have nothing to touch, now). Made me learn some awk; pretty nice language.


#!/bin/sh
# Dependencies: procps, iproute2, cmus, bar_fifo.sh, lemonbar, xdo
# Portability: Linux (/proc/stat)
set -u

bar_fifo=/tmp/bar.fifo
netif=enp3s0
mountpoint=~/Data
# Must support the `-e` option
term="st -c floating"

[ -e "$bar_fifo" ] && rm -- "$bar_fifo"
mkfifo "$bar_fifo"

trap 'trap - TERM; kill 0' INT TERM HUP QUIT EXIT

# bspwm workspaces status
bspc subscribe report >"$bar_fifo" &

# Clock
while true
do
printf 'c%s\n' "$(date '+%a %b %d %T')"
sleep 1
done >"$bar_fifo" &

# Battery capacity
# while true
# do
# awk -F= \
# '/CAPACITY=/ { cap=$2 }
# /STATUS=/ { status=$2 }
# END { printf "bbat: %02u%% (%s)\n", cap, status }' \
# /sys/class/power_supply/BAT0/uevent
# sleep 3
# done >"$bar_fifo" &

# Avail / total mem
awk -v delay=3 -v red='%{F#aa0000}' '
BEGIN\
{
while(1)
{
"free" | getline
"free" | getline
close("free")
printf "m%s%.1fG / %.1fG\n", ($7 / $2 < 0.25) ? red : "", $7 / 2^20,
$2 / 2^20
system("sleep " delay);
}
}' >"$bar_fifo" &

# Avail / total disk
awk -v delay=15 -v red='%{F#aa0000}' -v mountpoint=$mountpoint '
BEGIN\
{
cmd="df " mountpoint
while(1)
{
cmd | getline
cmd | getline
close(cmd)
printf "d%s%dG / %dG\n", ($4 / $2 < 0.1) ? red : "", $4 / 2^20,
$2 / 2^20
system("sleep " delay);
}
}' >"$bar_fifo" &

# Cpu usage %
awk -v delay=2 -v red='%{F#aa0000}' '
function stat_read()
{
getline < "/proc/stat"
close("/proc/stat")
}
BEGIN\
{
stat_read()
while(1)
{
system("sleep " delay)
split($0, old)
stat_read()
usersys=$2 - old[2] + ($4 - old[4])
usage=usersys * 100 / (usersys + $5 - old[5])
printf "p%s%02u%%\n", (usage > 90) ? red : "", usage
}
}' >"$bar_fifo" &

# IP address
while true
do
printf 'i%s\n' "$(ip a show "$netif" | \
awk '/inet / {gsub(/\/[0-9]+/, "", $2); print $2}')"
sleep 15
done >"$bar_fifo" &

# Cmus
while true
do
if ! pgrep -x cmus >/dev/null
then
printf 'M%s\n' '%{F#aa0000}cmus isn'\''t running'
else
cmus-remote -Q | awk -v term="$term" '
function value(line)
{
sub($1 FS $2 FS,"")
return $0
}

/^status/\
{
sub($1 FS,"")
status=$0
if(status == "stopped")
exit
}
/^tag (album|artist|title|date|tracknumber) /{val[$2]=value($0)}

END\
{
if(status == "stopped")
printf "M%%{F#aa0000}stopped%\n"
else
{
printf "M%s\n", \
(status == "paused" ? "%{F#aaaa00}" : "") \
"%{A:cmus-remote -C \"seek 0\":}%{R}|<%{R}%{A} " \
"%{A:cmus-remote -u:}%{R}" (status == "paused" ? \
"|>" : "||") "%{R}%{A} " \
"%{A:cmus-remote -C \"player-next\":}%{R}>|%{R}%{A} " \
"%{A:" term " -e tmux a -t cmus 2>/dev/null:}" \
val["artist"] " - " \
(val["date"] != "" ? "(" val["date"] ") " : " ") \
val["album"] " - " \
val["tracknumber"] ". " \
val["title"] \
"%{A}"
}
}'
fi
sleep 2
done >"$bar_fifo" &


~/.config/lemonbar/bar_fifo.sh <"$bar_fifo" | lemonbar -u2 -F'#aaaaaa' \
-f'-xos4-terminus-medium-*-*-*-14-*-*-*-*-*-*-*' -n "bspwm_bar" | sh &

xdo below -t "$(xdo id -N Bspwm -n root | sort | head -n1)" \
"$(xdo id -m -a "bspwm_bar")"

wait


 No.845964

>>845902

needs SSL


 No.846724

>>845949

Guess I'll post mine

#!/bin/bash
panel="$(getxresource deskenv panelHeight)"
underline_width="$(getxresource deskenv underlineWidth)"
font1="$(getxresource deskenv font)"
font2="$(getxresource deskenv fontFallback)"
fg="$(getxresource deskenv foregroundColor)"
bg="$(getxresource deskenv backgroundColor)"
active="$(getxresource deskenv activeColor)"
inactive="$(getxresource deskenv inactiveColor)"
underline="$(getxresource deskenv underlineColor)"

# function desktop {
# function desktop_loop {
# desk+="%{B${inactive}}"
# for workspace in $(seq "$@"); do
# desk+=" "
# done
# desk+="%{B-}"
# }
# local -a current_arr=($(xprop -root _NET_CURRENT_DESKTOP))
# local -a total_arr=($(xprop -root _NET_NUMBER_OF_DESKTOPS))
# local -i current="${current_arr[-1]}"
# local -i total="${total_arr[-1]}"
# local desk=""

# desktop_loop "$current"
# desk+="%{B${active}} %{B-}"
# desktop_loop "$((current + 2))" "$total"

# printf '%s' "$desk"
# }

function desktop {
function desktop_cond {
if bspc query -D -d "$desktop".focused.local &>/dev/null; then
desk+="%{B${active}} $name %{B${inactive}}"
elif bspc query -D -d "$desktop".urgent &>/dev/null; then
desk+="%{R} $name %{R}"
else
desk+=" $name "
fi
}
desk="%{B${inactive}}"
for desktop in $(bspc query -D); do
name="$(bspc query -D -d "$desktop" --names)"
if bspc query -D -d "$desktop".occupied &>/dev/null; then
desk+="%{+u}"
desktop_cond
desk+="%{-u}"
else
desktop_cond
fi
done
desk+="%{B-}"

printf '%s' "$desk"
}

function title {
declare -a active_win=($(xprop -root _NET_ACTIVE_WINDOW))
declare -a wm_name=($(xprop -id "${active_win[-1]}" WM_NAME 2>/dev/null))
if [[ -n ${wm_name[2]} ]]; then
name="${wm_name[@]:2}"
name="${name:1:-1}"
if (( ${#name} > 56 )); then
printf '%s...' "${name:0:56}"
else
printf '%s' "$name"
fi
fi
}

function clock {
date '+%a %d/%m/%Y %H:%M'
}

function volume {
local -a master=($(amixer get Master))
local -A suffix=(["[on]"]="%%" ["[off]"]="M")
local level="${master[-3]:1:-2}"
local status="${master[-1]}"
printf '%s%s' "$level" "${suffix[$status]}"
}

function res {
local -a perc=($(ps -eo "p${1}"))
perc[0]="0.0"
IFS="+" sum="$(printf '%s\n' "${perc[*]}" | bc)"
printf '%s%%%%' "${sum%%.*}"
}

function disk {
local -a d=($(df --output='pcent' "$1"))
printf '%s%%' "${d[1]}"
}

function network {
local -a route=($(ip route))
gateway="${route[2]}"
if [[ -n $gateway ]]; then
if ping -c 1 "$gateway" &>/dev/null; then
printf 'UP'
else
printf 'DOWN'
fi
fi
}

declare -a head=("%{l}" "%{r}%{B${inactive}} ")
declare -a sep=( " > " "%{F${active}} | %{F-}")
declare -a tail=("" " %{B-}")
declare -a content=(
"%s;desktop;;0
%s;title;;0"
"NET:%4s;network;;3000
ROOT:%5s;disk;/;100
HOME:%5s;disk;/home;100
DATA:%5s:%5s:%5s;disk;/mnt/data0 /mnt/data1 /mnt/data2;100
CPU:%5s;res;cpu;10
MEM:%5s;res;mem;10
VOL:%5s;volume;;0
CLK: %s;clock;;100")

declare -A buffer
declare -i tick=0
declare -i tick_lcm=3000 # precalculated from 'delay' in 'content'
while :; do
for ((i=0; i < ${#content[@]}; i++)); do
c="${content[$i]}"
buffer["$i,0"]="${head[$i]}"
declare -i j=0
while IFS=";" read -r fmt func args delay; do
if [[ $delay = 0 || $((tick % delay)) = 0 ]]; then
if [[ -z $args ]]; then
fmt_args=("$("$func")")
else
fmt_args=()
for arg in $args; do
fmt_args+=("$("$func" "$arg")")
done
fi
out="$(printf "$fmt" "${fmt_args[@]}")"
buffer["$i,$((j * 2 + 1))"]="$out"
if ((j)); then
if [[ -n $out ]]; then
buffer["$i,$((j * 2))"]="${sep[$i]}"
else
buffer["$i,$((j * 2))"]=""
fi
fi
fi
((j++))
done <<< "$c"
buffer["$i,$((j * 2))"]="${tail[$i]}"
done
tick="(tick + 1 ) % tick_lcm"

buf=""
for ((i=0;; i++)); do
for ((j=0;; j++)); do
if [[ -z ${buffer["$i,$j"]+x} ]]; then
break
else
buf+="${buffer["$i,$j"]}"
fi
done
if ! ((j)); then
break
fi
done

printf '%s\n' "$buf"
sleep 0.1
done | lemonbar -d -g "x${panel}" -u "$underline_width" -f "$font1" -f "$font2" -B "$bg" -F "$fg" -U "$underline" "$@"

and here's the 'getxresource' dependency

#!/bin/sh
if [ $# -eq 1 ]; then
major="\\*"
minor="$1"
elif [ $# -ge 2 ]; then
major="$1"
minor="$2"
elif [ $# -eq 0 ]; then
exit 1;
fi

xrdb -query | grep -E "^$major\\.$minor:" | awk '{print $2}'


 No.847299>>847312

>>793034 (OP)

Roll, give me something good.


 No.847312

>>847299

>TI-86 emulator

I don't know shit about emulation, but it looks like the TI-86 has a 80 cpu so I'll ry emulating that first.


 No.847492>>849956

I'm new to python and wanna know a good graphics library that has a distance function and the ability you can make shapes with individual points


 No.849738

rollen


 No.849956

>>847492

>im new to python

>i want to do graphics programming

>in python

>im new to python

>graphics programming

>python


 No.849961

time to learn C fucker


 No.851393>>851400

Hey faggots whats a good book for continuing learning C# at an intermediate level? So far all the books I've come across assume you don't know fuck all about C# or programming, so 95% of the stuff in it I already know.


 No.851400

>>851393

C# For Offshore Programmers by Pajeet Curryshit


 No.852223

>>793257

>Django

Not too familiar, but I guess it's as good a web framework as any

>ReactJS & Angular (how common?)

Very common. I recommend React

>Firebase (for android dev.. don't really know what's common 'stack' there or just plain android SDK)

I wouldn't bother with Firebase, you have to learn their tools and when you have, you are stuck with an expensive system owned by someone else. In that time you could have built your own backend.

>Java EE (that shit gives me cancer.. everything has a dependency of dependency with their separate XML config files)

Never used it but if you want to do web dev or apps, I guess you can skip this?

>I'm too dumb to work with C, sure I can use it for hobby projects but I suck at math and logical thinking.

Lol, C is not different from other programming, it's just more confusing at first cause of pointers.


 No.856017>>856018

Been doing Project Euler in Forth. New to Forth, I reckon there's a lot of optimisations I could make here. Computes prime factors:


: factors
( a -- f1 ... fn )
2
begin
2dup /mod swap 0=
\ if cr . dup . swap .s recurse
if swap . recurse
\ if swap recurse
else drop
then
2dup >
if 1+ 0
else 1
then
until ;


 No.856018

>>856017

Ignore lines prefixed with '\', those were commented test lines.




[Return][Go to top][Catalog][Screencap][Nerve Center][Cancer][Update] ( Scroll to new posts) ( Auto) 5
347 replies | 36 images | Page ?
[Post a Reply]
[ / / / / / / / / / / / / / ] [ dir / agatha / animu / asmr / ausneets / leftpol / orbg / sw / ztg ][ watchlist ]