[ / / / / / / / / / / / / / ] [ r8k / ck / wooo / fit / random / doomer / f1 / foodism / harmony / lathe / lewd / warroom / wtp ]

/prog/ - Programming

Programming

Catalog  Archive

Name
Email
Subject
REC
STOP
Comment *
File
Password (Randomized for file and post deletion; you may also set your own.)
Archive
* = required field[▶Show post options & limits]
Confused? See the FAQ.
Options

Allowed file types:jpg, jpeg, gif, png, webp,webm, mp4, mov
Max filesize is16 MB.
Max image dimensions are15000 x15000.
You may upload5 per post.


File: 1453418162765.jpg (19.9 KB,225x350,9:14,292080.jpg)

78ff58 No.3859 [Open Thread]

/prog/, have you worked on a distributed extensible autonomous REPL before? How would I go about it?

____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

78ff58 No.3867

What the fuck does that even mean?

How would you make an autonomous REPL? Autonomous means self functioning without input. A REPL is a user input/output interface.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

78ff58 No.3870

>>3859

i am actually working on the same thing. have you done any work at all. maybe we can collaborate

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

78ff58 No.3881

>>3859

>distributed extensible autonomous REPL

This sounds like a manager trying to buzzwordily say "AI hive mind" who only sort of knows what each word means.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.



File: 1451939639934.jpg (57.03 KB,851x315,851:315,Anonymous One Team To Save….jpg)

1b208c No.3807 [Open Thread]

ADVANCED HACKING TOOLS.zip DOWNLOAD

https://archive.org/details/ADVANCEDHACKINGTOOLS

____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

1b208c No.3850

>>3807

Thanks

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

1b208c No.3851

omg thx op i cum on cat she hiss at penis

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

1b208c No.3854

>not just downloading Backtrack

Anyone that downloads this is an idiot and has no business doing what they are attempting to do.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

1b208c No.3868

>>3807

oh boy I can finally be a hacker

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

1b208c No.3869

/prog/ humor, like /tech/ humor except several orders of magnitude slower.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.



File: 1451855068740.gif (454.97 KB,242x318,121:159,Stu Loses Control.gif)

a13374 No.3804 [Open Thread]

How plausible is finding a remote job as a middle C++ dev?

One of my internet buddies works through upwork, but based on what I've heard from him, it's not very pretty. Remote jobs are mostly web-related and very few job propositions that are there quite often are small, low pay contract jobs that have tons of indians competing, promising that they'll make it for free and this instant.

____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

a13374 No.3806

>>3804

I'd recommend using upwork as something you just regularly keep up with, but don't be in any rush to land work on it, because you'll either end up under selling your work or giving up out of frustration.

I know people who have found solid clients that they regularly work with from there and I would say I get contacted by what I consider to be legit companies once every couple months and I don't even network there, that is just from companies finding my profile.

You just have to position yourself as professional software developer who is interested in finding the ideal client, you're not some desperate curry nigger who will work for third world wages.

Unfortunately, it will take some time and you'll have to keep at it, but once you find a few legit clients, it is all worth it.

If you're needing to pay the bills right away, then obviously you're just going to have bite the bullet and find whatever you can locally.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

a13374 No.3812

>>3806

Can you give me some advice on making my profile?

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

a13374 No.3842

>>3812

Stuff it with keywords relevant to the types of work you'd like to do so when they're searching for contractors your profile shows up.

Just talk about your experience, your knowledge, the type of work you are capable of doing and the type of opportunities you are personally interested in. Mention that you are a native english speaker because this will matter to your ideal clients.

Include a picture regardless of your opinion of your looks, just like on dating sites, profiles with pictures draw more attention.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.



5eb464 No.3829 [Open Thread]

Alright, faggots. You're going to take a first-year computer science class at MIT.

https://www.edx.org/course/introduction-computer-science-mitx-6-00-1x-6

Register. It starts next week.

>But Python is for plebs!

Well, good thing that Harvard is running a course that uses C and recommends Linux. No excuses. This one is even self-paced.

https://www.edx.org/course/introduction-computer-science-harvardx-cs50x

>But muh blub languages

I SAID NO EXCUSES. Here's a course that uses Scheme. This one is also self-paced.

https://www.edx.org/xseries/systematic-program-design

Those are your choices. If you don't choose any of these, you're a lazy sack of shit.

Even if you already know the basics of programming, you will almost definitely get something out of these if you haven't had a formal education yet.

If we do it together, we can make threads about it and encourage each other. I'm doing the third one, and I've been programming for 2 years.

____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

5eb464 No.3836

Sure.

I'll join you through Systemic Program Design.

I'm going to check out the Harvard one, I initially passed on it because it seemed like they use a multiple languages meant they wouldn't really get that deep into the subject, but the reviews seem to be very positive.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

5eb464 No.3837

>>3836

the use of multiple languages*

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

5eb464 No.3840

>>3836

It's pretty popular. I was talking to a woman at my university who helps put things on EDX, and she had heard of it and wanted to take it.

I started on it last year, but life got in the way. From what I saw it was pretty good, but obviously it's still only a first year introductory course. I would have been taking it this time, but I just couldn't resist a modern course in Scheme.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.



File: 1452310435251.png (145.99 KB,1920x1125,128:75,based.png)

6aff7f No.3833 [Open Thread]

Guys, I had this script which enabled me to make my computer write whatever I chose, using Chrome. It no longer works. Why? and how to fix it?

I'll copypasta the script in the thread.

____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

6aff7f No.3834

Here's the post from the anon who taught me how to do this:

in google chrome do this:

1. press ctrl-shift-j

2. paste this script, DO NOT FUCKING HIT ENTER YET

(function() {

var text = prompt("Enter some text.");

var width = $(".active-cursor").width();

var height = $(".active-cursor").height();

var start = $(".active-cursor").offset();

var current = {

top: Math.round(start.top + height / 2),

left: Math.round(start.left + width / 2)

};

var i = 0;

function next() {

var c = text.charAt(i);

if (c === "\n") {

current.left = start.left;

current.top += height;

} else {

$(document.elementFromPoint(current.left, current.top)).click();

w.typeChar(c);

current.left += width;

}

i++;

if (i < text.length) {

setTimeout(next, 10);

}

}

next()

})();

3. copy the ascii you want to post

4. press enter, a prompt will come up, paste your ascii into the prompt

5. profit!

for repeat pastes you only need to go to the java console and press the up arrrow, it will recall the last script you used even if you have closed chrome and opened it again

if you don'Post too long. Click here to view the full text.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

6aff7f No.3838

>>3834

What is the error message you are getting in the javascript console?

I'm getting a TypeError: cannot read property 'top' of undefined.

That 'undefined' is start.

$('.active-cursor').offset() returns undefined when I try to run your script

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.



File: 1451590124908.jpg (46.65 KB,500x670,50:67,starfox.jpg)

18059a No.3787 [Open Thread]

Lads I have been trying to teach myself c++ and this exercise from my book is driving me crazy!

"Write a program in which you create a Text class that contains a string object to hold the text of a file. Give it two constructors: a default constructor and a constructor that takes a string argument that is the name of the file to open. When the second constructor is used, open the file and read the contents of the file into the string member object. Add a member function contents() to return the string so that you can display it. In main(), open a file using Text and display the contents."

I have a full solution that compiles but does not actually store any information from the inputed file (it prints empty lines or sometimes a single } )

http://coliru.stacked-crooked.com/a/d1ab2c2ad4e1b05d

Help me obi-wan you are our only hope

4 posts and 1 image reply omitted. Click [Open Thread] to view. ____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

18059a No.3795

>>3792

It's a great example of why you should never write it either his way or the way you suggested - it's so easy to accidentally leave a stray line terminator in that changes the logic. A better style is


while(...) {

as it resists these types of bugs (which are actually rather common in real code by good programmers). People get super stubborn about this even though this style is objectively better due to the lowered error rate. It's also a good example of why python got it (mostly) right with its spacing.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

18059a No.3799

>>3795

> this style is subjectively better

> FTFY

If you use Allman style and always use braces, even when there is only one statement, then you don't make these sorts of errors.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

18059a No.3831

The first thing you should do is fix all warnings and then quickly go fuck yourself for not using plain C.

Also write in some if statements to check whether or not you variables actually have any /value/.

guday m8

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

18059a No.3832

>>3795

Or you could format code in a decent way and not be a retard/faggot.

If you are used to writing shit this way you shouldn't have errors. It also makes you look 1337 as fuck.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

18059a No.3856

>>3792

Never Python. Not even once.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.



File: 1452304624517.jpg (43.29 KB,526x526,1:1,kista.jpg)

6e4d85 No.3830 [Open Thread]

i need some serious help. i was in court today and the prosecutor asked the secretary if it was possible to run the vin and see when that vehicle had insurance and when it was canceled and so on. she said no. got me thinking if i can write a code and bring it maybe i can get off. what language would be best for this do you guys think. basically i need the prog to have a search bar to put in the vin. then i need it to search the databases of the insurance companies (with permission of course) just wondering what language and where i should start. writing the code or getting permission. i think i should write the code show it to them then they can get the companies databases since they wouldnt want to give it to a criminal. please help. here is a pic of my baby shaking her bones to trey and the gd at fare thee well gd50

____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

6e4d85 No.3835

>(with permission of course)

You won't get direct access to the database, ever. Even if you have a court order for something from the database, they won't give you access, they will instead search the database themselves and then give you only the data that was specifically ordered. Don't even write a single line of code until they give you an account on a database server.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

6e4d85 No.3848

This thread is retarded. Insurance company databases don't just sort of have public interfaces you can plug into to pull arbitrary information about arbitrary VINs. You would have to either contact the company and have them give you the information or get the info off their website customer portal.

Furthermore, if there was a standard public interfaces for this, there would already be 50 different programs to pull the information.

It's pretty telling that you only describe the search function as "have a search bar". You either have no idea how to program or just know minimal bits of web design.

This is " code a GUI in Visual Basic to trace the killer's IP" level of retarded.

tl;dr: not only is it not possible, you also have no idea what you're talking about in the first place.

Your baby is a hippy retard and you probably are too, fuck back off to Reddit r/reiki/ or whatever stupid fucking spirit science board you come from.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.



File: 1450844390813.jpg (38.85 KB,475x740,95:148,lfd.jpg)

8298ef No.3752 [Open Thread]

Hello /prog/,

I would like to start off this new year by committing to learning at least 1 new, major library or SDK. Why only 1 library for the year? This way we don't end up hopping from library to library without gaining any real skill. This way we get to master it.

I suggest these:

>Android (make mobile apps, make money!)

>OpenCL (accelerate your computation, put that graphics card to better use!)

>Qt (gui's and so much more!)

>SQLite (master your data!)

Alternatively, it would also be very useful for any anons looking for a job to master machine learning techniques. I was thinking of working through pic related for starters. Would any anons be interested in learning neural nets / svm's / relevant tools, techniques, and libraries instead?

Who else would be interested in this? Are there any very useful, very practical libraries you would recommend beyond those listed?

After we settle on a library / learning we work through it for the year, post code, results, ideas, advice, explanations, and keep each other motivated.

____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

8298ef No.3776

how about

>have an actual goal

>learn what you need in order to achieve that goal

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

8298ef No.3780

>>3752

I've just started learning Android development.

I'm stating off with the free Udacity course. It's way slower than I'd like as it is designed for complete programming noobs, but it's material seems to be comprehensive, as I've had little problem following along and building the simple apps.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

8298ef No.3786

>>3780

yes same here, just starting out but i've made some simple apps.

maybe we should make this an android app coding thread. and we try to make the most interesting apps and share them.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.



File: 1451330733539.png (348.7 KB,540x396,15:11,12391045_847259475371410_1….png)

1a6620 No.3775 [Open Thread]

I need help. I am working on a text editor for mobile and its a hybrid app, so its made with web technology. Everything is fine and all until I want to make a button that bolds future text, kind of like in Word. But I can only find one that makes everytext in the text area bold. This is not what I want. I cant find any help on how to do this in Javascript/Jquery on the internet.

This is what I have with jquery and jquery mobile:

$("#bold").on("tap",function(){

$(".editor").toggleClass("bold");

});

It makes every text in the editor bold. I want to make only future text bold.

Can someone help me?

Thank you

____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

1a6620 No.3777

>text editor

>bold

well you're off to a bad start.

In order to do this, you can't have a single text area. when the user clicks bold you need to add a new DOM element with a bold style, and you need to handle mouse-clicks, arrow movement, selections, etc., to make your dense list of DOM elements function like a single area. it's a tremendous amount of work for literally no payoff: your users would be just as happy typing [b]blah[/b]

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

1a6620 No.3778

>>3777

Ahh so what your saying is when a user clicks the bold button, I'll need to replace the text area in the background? That sounds like a lot of extra work but nothing too bad to be honest.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.



9d5869 No.2970 [Open Thread]

Bring all dirty, disgusting and generally cancer code here.

I start

http://pastebin.com/DYCcxWER

Because "Hello, World!" is too mainstream

____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

9d5869 No.3769

>>2970

Got a laugh out of me

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.



7b3b8e No.3760 [Open Thread]

This seems to be the best board for this question, what are the most important Terminal commands to know? So far, I only know the following.


pwd
ls
cd
sudo -i
vi(m)
apt-get install
gcc -o file *.c

____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

7b3b8e No.3761

grep

sed

find

awk

make

ed

man

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

7b3b8e No.3763

The most important terminal commands are

[code]\n

\r

\e[30m thru \e[37m

\e[40m thru \e[47m

\e[1m

\e[0m

\e[2J

\e[?25h and \e[?25l

\e[n;mH with n and m as coordinates

\e[s and \e[u

\e[n;mr with n and m as the top and bottom row[code]

That last one is pretty killer.

inb4 curses. You may as well use a fucking web browser.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.



3dfbc1 No.3749 [Open Thread]

Just started my first year in my computer science course at university, just wondering what the good books are to get a head start

____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

3dfbc1 No.3759

File: 1450988845777.pdf (2.3 MB,sicp.pdf)

:^)

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

3dfbc1 No.3785

>>3749

if you haven't read donald knuth's set yet you're pretty much fucked at this point tbh. good luck.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

20c593 No.5271

alacrity

fuckin shit

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.



File: 1450783874042.jpg (52.76 KB,700x497,100:71,microsoft-office-2.jpg)

a1847a No.3750 [Open Thread]

so, i was thinking about starting the development of a "normal" program, and i have honestly no idea how to that, since i never created something with a proper interface.

with "normal" i'm talking about a program meant to be used by not expert, with the standard stuff like automatic re size of windows and stuff like that. The office family is pretty much my idea.

are there some libraries that allow you to implement standard features like control+z?

do they have a simple graphic engine?

and how "normal" programs are even called?

____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

a1847a No.3751

You mean a GUI program?

It might be more complex than you think.

The big standard windowing and GUI APIs are Win32 for Windows, Cocoa for Mac OSX, and Xwin for Linux and BSD (though almost nobody uses Xwin raw).

If you want cross-platform, you should look into GTK or Qt, or even wxwidgets.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.



File: 1450393789140.png (147.95 KB,1920x953,1920:953,aloonix.png)

41a193 No.3734 [Open Thread]

Hi, for years, I've been writing most of my things in python, where it's completely unacceptable to be calling external commands, and been working on low level things with C and assembly, where I barely even need libc most of the time, so calling external commands in a program other than a shell script is very weird to me.

Now, after opening my eyes to (the awesomeness that is) lua, I'm wrapping a script around a tool written in shell (can't be written/it's very cumbersome to write in anything else, for a number of reasons). I'm also calling curl somewhere in the script. I do this because I've used libcurl in C before, and to me, the library doesn't seem to be made for using it to simply get a file, and instead, the command line interface is.

I'm aware that calling external commands breaks portability, but that is a non-issue in this case.

Now, I'm debating if I should either call find -type f or use LuaFileSystem to recursively iterate over every file in a directory.

I'd like to know: What is the most acceptable option, calling curl and find, or using their respective libraries? Also, is one of the options actually objectively better?

____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

41a193 No.3740

Using the libraries and APIs is better unless you need the flexibility. Don't call an external program unless you need to. On top of the pain of fork and execing, it's also much more expensive and far less efficient.

Also, curl is just a thin wrapper around libcurl anyway.

It's hard to know what would be the proper way exactly without knowing your exact use case. The best option, though, is to either use libcurl and readdir/readdir_r for those two uses, or luacurl and luafilesystem, depending on which part of your program and how integrated you want that functionality to be.

You usually don't want to fork and exec unless you want to be able to invoke external functionality dynamically, such as having the user specify a command to use (like with a shell, or with any system that needs user plugins that should be language-agnostic, can work with program output, and don't need real IPC).

Don't call an external command unless you really need to and it fits your workflow. Doing an external call to something like curl or find is redundant, pointless, and prone to way more bugs. Not to mention that the overhead of managing the forked process as a child and making sure it exits properly and everything that goes with it is way more work than just using libcurl and readdir properly.

Here's the basic way with a fork:


int pipefd[2];
pipe(pipefd);

pid_t parent = getpid();
pid_t pid = fork();

if (pid == -1)
{
// Some error forking
return 1;
} else if (pid > 0)
{
// I am the parent
// Close writing end
close(pipefd[1]);

ssize_t newstart = 0;
char buffer[BUFSIZE];

while (true)
{
// Do the BUFSIZE - newstart - 2 for necessary injected characters, if needed
ssize_t size = read(pipefd[0], buffer + newstart, BUFSIZE - newstart - 2);

// This is done because the buffer was already offset. We want size
Post too long. Click here to view the full text.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

41a193 No.3741

It just occurred to me that you probably meant calling the script in Lua with pcall or something.

You can do that, but still keep in mind it will be far slower and more prone to bugs. You also have issues if you want to be able to get stdout, stderr, and exit status at once.

It is also worth mentioning that POSIX does have a simpler popen interface that wraps forking and execing. I haven't done POSIX C programming in a while.

Either way, native is always faster than forking. You fork and exec if you need the flexibility to decide certain things at runtime.

Now, practically, it will make little difference as long as find is there and the output is reliable. Objectively, forking is a worse option, but you won't notice a difference in runtime or anything unless you are doing some very heavy CPU-bound work.

I'd say to implement both ways and see what works best for you, if time isn't an issue.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

41a193 No.3744

>>3741

Yeah, I'm using system(3) and popen(3) from Lua depending on if I need to get the output.

I'm aware that calling the commands without the popen(3) interface from C is way more tedious, but that isn't the case from Lua, where it's two lines at best.

Thanks for providing your insight. You're right, using the libraries is the preferable way. There's just too many incompatibilities with implementations of commands, and sometimes the commands aren't even available and you just find out during runtime.

However, working in an environment I'm writing shell scripts for anyway (those are way more sensitive to the environment than Lua, and I'm using both curl and find in them) and not wanting to redistribute the lua script, I don't think it really matters in terms of being error-prone. In terms of being cpu-intensive… Again, script argument. Those call a command on nearly every operation. I think that's way more cpu-intensive. (and it doesn't really matter either, it's fast enough). So I can just use any method in this case, while still preferably the library method.

I just have to add one thing: It really depends on whatever you're doing if the readability increases or not (at least in lua). Doing "for file in io.popen("find"):lines()" is way less tedious than the example on the luafilesystem page to recursively iterate over a directory. Same thing goes for curl, really.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

41a193 No.3748

>>3744

That's a good point. In the end, whatever gets the job done and doesn't break is preferable if you can get it up and running.

The primary argument to library vs forking for me is flexibility. If you need to do something to files while iterating over them (such as taking a stat of each, or checking extended filesystem attributes), you can more easily do it with the library system.

If you're willing to handle the small performance hit of forking (and to be honest the performance impact of both filesystem access and network transmission are far higher) and you are sure the command syntaxes can be consistent, it's just up to personal preference.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.



File: 1447702914061.jpg (19.88 KB,329x213,329:213,falsiness.jpg)

c3b352 No.3589 [Open Thread]

What is something you hate about programming in general?

In other words, what programming features do you hate most that nearly every language incorporates?

Personally, I fucking loathe falsiness.

I hate it when any language inherently treats 0 as false, or empty strings, or empty lists, or NaN floating point values. It's excusable in C, and in C++ for C compatibility, but any language with a dynamic type system has no excuse.

The only things that should evaluate false are an actual boolean false value, or a null pointer (ie. pointer type with a null value, where type is significant, as integer 0 should still evaluate true).

5 posts omitted. Click [Open Thread] to view. ____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

c3b352 No.3722

>>3589

>fucking hate falsiness

>null should be falsy

I hate gets() and scanf(). In CURRENT_YEAR, these libc functions should do nothing but cause a compile-time error, telling you to use shit that isn't fundamentally insecure (in the case of gets) or fundamentally incapable of interacting reasonably with a user (in the case of scanf). Read in lines at a time, into buffers that can contain those lines, and use sscanf() on read lines if you really want that shit.

I hate how every 'modern' 'advanced' 'high-level' programming language is stuck in the 90s. The Linux kernel continues to advance. It has all kinds of cool system calls. You can do shit like swap the names of two files without a race condition. But fuck it, Windows doesn't have that, and it wasn't portable among unices back in 1995.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

c3b352 No.3723

oops that second one wasn't a future.

Replacement hate: laziness.

It is the solution for literally nothing, but it introduces all kinds of problems of its own.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

c3b352 No.3726

>>3722

Null being falsy is unambiguous in almost every case.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

c3b352 No.3728

>waah waah languages arent 100% theoretically correct

Fucking pretentious losers in this thread, what have you accomplished besides bitching?

https://en.wikipedia.org/wiki/Parkinson%27s_law_of_triviality

Go and write something more complex than "hello world" to have some weight behind your words before you act like a software god. Your code probably runs like shit, and that's not because gets() and scanf() suck, >>3722

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

c3b352 No.3737

>>3728

I'm a professional programmer who has to use dozens of languages through work; you get a long list of things to hate when you have to use tons of different languages in codebases written by other people.

Why are you afraid that people might actually learn something and improve?

You can't really invoke Parkinson's Law of Triviality here, given that what we're talking about are basic programming features that affect every aspect of the language. That's the opposite of the Law of Triviality.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.



Delete Post [ ]
[]
[1] [2] [3] [4] [5] [6] [7] [8] [9]
| Catalog | Nerve Center | Random
[ / / / / / / / / / / / / / ] [ r8k / ck / wooo / fit / random / doomer / f1 / foodism / harmony / lathe / lewd / warroom / wtp ]