420chan now has a web-based IRC client available, right here
Leave these fields empty (spam trap):
You can leave this blank to post anonymously, or you can create a Tripcode by using the float Name#Password
A subject is required when posting a new thread
[*]Italic Text[/*]
[**]Bold Text[/**]
[~]Taimapedia Article[/~]
[%]Spoiler Text[/%]
>Highlight/Quote Text
[pre]Preformatted & Monospace text[/pre]
1. Numbered lists become ordered lists
* Bulleted lists become unordered lists


Community Updates

420chan now supports HTTPS! If you find any issues, you may report them in this thread
Looking to learn more. by Doris Femmlewidge - Sat, 03 Sep 2016 14:28:27 EST ID:iP/biX2m No.36100 Ignore Report Reply Quick Reply
File: 1472927307091.jpg -(100601B / 98.24KB, 763x427) Thumbnail displayed, click image for full size. 100601
I am a beginner when it comes to programming. I am familiar with python and some front end but I wanted to learn something I considered obscure. I wanted to Learn LISP. I come here to ask for any suggestions on where or what I should start learning next?

Pic related.
13 posts and 3 images omitted. Click Reply to view.
Samuel Girringket - Fri, 23 Sep 2016 16:52:48 EST ID:mqog9WTN No.36195 Ignore Report Quick Reply
With a language like Haxe, I would think the typical use case for multiple main functions would be for having separate code for different compilation targets.
Hannah Lightham - Sat, 24 Sep 2016 20:25:29 EST ID:RufML0b0 No.36198 Ignore Report Quick Reply
1474763129546.png -(467733B / 456.77KB, 871x687) Thumbnail displayed, click image for full size.
That is what I mean by multiple programs. Often I'll have a client on JS and a server on C++ or Java. Both share models, but only JS needs graphics code.

It is pretty great that I don't need to implement client and server logic twice. And without resorting to a shitty NodeJS stack.
John Givinghall - Sat, 24 Sep 2016 21:02:14 EST ID:9QSfnS0r No.36199 Ignore Report Quick Reply
Yeah that's cool and all, but as I see there is really only documentation for how to use javascript native libraries. Documentation on other targets seems lacking or even missing ( in case of java ).
I guess if you are doing pretty basic stuff in the backend so you can only use haxe libraries and your own code is fine.
But then I can't imagine the community for haxe is large enough to provide that.

All in all I don't see a benefit to the traditional workflow where you write the frontend and backend code yourself besides not requiring any premium ide package.
Hannah Lightham - Sun, 25 Sep 2016 15:28:44 EST ID:RufML0b0 No.36200 Ignore Report Quick Reply
>Documentation on other targets seems lacking or even missing
Anyone can write a backend for Haxe, so some aren't as well documented. I've never found the documentation or support to be lacking thou, and I just crawl through source code if something isn't documented.

>I guess if you are doing pretty basic stuff in the backend so you can only use haxe libraries and your own code is fine
Not sure why you would assume that. I don't know how many libraries you normally use in a project, but I generally write most of my server code. The built in Java libraries are generally all I need.

>I don't see a benefit to the traditional workflow
Faster development? Macros? Pattern matching? Dynamic types and high order functions? Haxe has many improvements on its targets.

>besides not requiring any premium ide package
I'd avoid any language that needs an IDE. I rolled my own Emacs mode for haxe.
Jarvis Debberridge - Sun, 25 Sep 2016 20:27:27 EST ID:9QSfnS0r No.36201 Ignore Report Quick Reply
I try to avoid any software development library that doesn't provide a complete official documentation.
That said I see there is a MVC web framework for haxe which I would look into if it had documentation beyond the autogenerated API docs. http://ufront.net/

If you think software development is anything but 80% reading documentation and 20% writing code you are delusional imho.

GCC diagnostics are great, but they are not enough by Overflow - Thu, 01 Sep 2016 08:05:00 EST ID:1Cry0o0J No.36092 Ignore Report Reply Quick Reply
File: 1472731500014.png -(224154B / 218.90KB, 604x540) Thumbnail displayed, click image for full size. 224154
Bugs found in GCC with the help of PVS-Studio: http://www.viva64.com/en/b/0425/
Martin Clayhood - Thu, 01 Sep 2016 17:13:05 EST ID:aJAX07lc No.36095 Ignore Report Quick Reply
smells like spam.
Lydia Buzzridge - Sat, 03 Sep 2016 15:15:02 EST ID:F+scHBch No.36101 Ignore Report Quick Reply
Well how bad are the bugs?
Clang is probably better anyway, but never tried to switch.
Isabella Dundlebot - Tue, 20 Sep 2016 18:57:40 EST ID:CUeO0MBJ No.36185 Ignore Report Quick Reply
  1. This post is advertisement.
  2. -Wall isn't enough anyway. I recently found out about -Wconversion, which is not covered by -Wall. Go read: http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
  3. PVS-Studio costs money (it even has licensing plans, yo!), GCC doesn't, and I'm only a hobbyist, probably like most posters here.
Isabella Dundlebot - Tue, 20 Sep 2016 19:02:18 EST ID:CUeO0MBJ No.36186 Ignore Report Quick Reply
Maybe pitting GCC vs PVS-Studio would be a good idea, anyway:
Let GCC try to find issues in PVS-Studio; then let PVS-Studio try to find issues in GCC.
Charles Pocklock - Tue, 20 Sep 2016 19:08:06 EST ID:4Qqv0Ibg No.36187 Ignore Report Quick Reply
You just bumped an ad to point out that it's an ad. Great job. nb

Advice by Hannah Clottingbury - Sat, 23 Jul 2016 08:05:47 EST ID:rK/rO6pk No.35894 Ignore Report Reply Quick Reply
File: 1469275547373.jpg -(106208B / 103.72KB, 1200x1628) Thumbnail displayed, click image for full size. 106208
I'm getting a small review done off my site (not very big or successful). It's made of angularJS, C# Web API and MS SQL Server (not very trendy). I'm being asked what the stack is.

Is it:

A: Bad for security reasons to tell them this.
B: Bad rep to admit it (since the cool kids don't use microsoft)

Thanks for any advice, really struggling with this one.
4 posts omitted. Click Reply to view.
Henry Feblingtadge - Sun, 24 Jul 2016 19:44:57 EST ID:Q1Kx57v7 No.35911 Ignore Report Quick Reply
Just say you are on an angular + MS stack.
David Gashson - Tue, 09 Aug 2016 03:20:43 EST ID:NKdom05x No.35981 Ignore Report Quick Reply

>security concern (don't want to increase chance of database hacking)

If your database is somehow vulnerable, it won't make a difference whether or not an attacker knows what database you are running. The kind of hacker that is a threat for your small website that -- no offense, the same applies to myself and my website -- nobody really cares about is the kind of hacker that is not doing manual work but just running scripts which try every kind of attack it knows about for every kind of database and other kind of applications. So due to this, if your database is vulnerable, they will find that vulnerability.
Charles Sanningbanks - Wed, 31 Aug 2016 14:22:59 EST ID:mX05OzHB No.36088 Ignore Report Quick Reply
Man I dont know.
Augustus Hennerfield - Wed, 14 Sep 2016 14:35:16 EST ID:pJbbrFEH No.36150 Ignore Report Quick Reply
1473878116090.jpg -(14563B / 14.22KB, 304x425) Thumbnail displayed, click image for full size.
Reported this stupid fucking idiot for shitting up OPs thread and no actions from staff.
I'm beginning to think bru is a troll mod.
pic related, it's bru / justin
Cedric Mushwudge - Thu, 15 Sep 2016 17:41:28 EST ID:h666BHp6 No.36156 Ignore Report Quick Reply
Don't hold out on us Bru are you going to get training with that lovely lady?

government computer programs by Priscilla Ceblingman - Thu, 25 Aug 2016 13:38:53 EST ID:xTilwW1W No.36059 Ignore Report Reply Quick Reply
File: 1472146733963.jpg -(410120B / 400.51KB, 1422x800) Thumbnail displayed, click image for full size. 410120
do you think computer programs could be created to run certain areas of the government?
1 posts omitted. Click Reply to view.
William Fuckinghood - Fri, 26 Aug 2016 17:14:05 EST ID:VAZu238H No.36065 Ignore Report Quick Reply
Imagine if you had to dig to catch something in pokemon go.
You could create an ant like species of human hiveminds.
Graham Hendleway - Fri, 26 Aug 2016 22:53:21 EST ID:W/zS63TD No.36066 Ignore Report Quick Reply
A program in deadlock could simulate Congress.
Albert Hebblestet - Sat, 27 Aug 2016 14:28:42 EST ID:e7bTcYy7 No.36072 Ignore Report Quick Reply
Absolutely. The tax code is clearly the biggest one begging to be turned into simple code. But a lot of middle man administration can replaced with code with no problem.
I'm hoping for a day when instead of voting on laws we vote on pull requests.
Ernest Pillybetch - Sat, 03 Sep 2016 15:49:28 EST ID:jqcg4eTQ No.36104 Ignore Report Quick Reply
Isn't there a movie coming out where these faggy 18 yo seniors get a mobile game that has them do life threatening shit for points?
Simon Gonkinworth - Sun, 11 Sep 2016 22:31:14 EST ID:RcamD32+ No.36134 Ignore Report Quick Reply
1473647474160.jpg -(45029B / 43.97KB, 274x406) Thumbnail displayed, click image for full size.
this might interest you

I'm bored. Should I learn SQL? by Albert Crappershaw - Sat, 13 Aug 2016 14:28:00 EST ID:Z4pGy3+m No.35991 Ignore Report Reply Quick Reply
File: 1471112880939.jpg -(50114B / 48.94KB, 348x541) Thumbnail displayed, click image for full size. 50114
Hey guys,

I've never looked much into SQL, probably because I always heard it's easy which made me think it would bore me pretty quickly.

Yet it appears to be a must-known language so now might be the time for me to finally dwell into it.

Should I go for it, should I use MySQL? If not, what would you recommend?

I'm pretty clueless about that, even after a few Google searches.

21 posts and 1 images omitted. Click Reply to view.
Ernest Dobbershaw - Mon, 22 Aug 2016 16:14:03 EST ID:wXwDJrio No.36044 Ignore Report Quick Reply
json-ld just looks like another network data model to me, I really don't see anything new in it.

It sounds like you want everything related to an employee to be marked as such. For that, I'd like to see support for domains and roles, separately, where we only have column names now. So all the employee_id columns can be unified under a single employee domain. FK constraints are mostly used for this now, but FK constraints are physical level integrity features, referring to specific columns and not logical domains, so a chain of constraints may be required to resolve whether two columns currently refer to the same domain, and in some cases no FK constraint is required. We really need a separate concept.
Martha Claddlekore - Wed, 24 Aug 2016 17:53:47 EST ID:9QSfnS0r No.36057 Ignore Report Quick Reply
Yeah the schema here can be done better, if every order has one employee it wouldn't make sense for many different employees to get bonuses from one order, but nevertheless that's what this is.
The point was more to show how you need one to one, one to many and many to many relationships and modelling them by sql feels somewhat like C pointer arithmetic.
Nell Guttinglirk - Thu, 25 Aug 2016 16:24:44 EST ID:LO1w4lnU No.36060 Ignore Report Quick Reply
What about higher order relationships like many-to-many-to-one?
Oliver Hippergold - Sat, 27 Aug 2016 20:22:51 EST ID:9QSfnS0r No.36075 Ignore Report Quick Reply
They can be expressed with a many to many and a one to many I guess.
Are you actively trying to make my brain hurt?

Anyway is there such a thing like an ominous high level database language? Like LDAP but fast? hmm...
Jenny Smalllock - Sun, 28 Aug 2016 15:16:13 EST ID:LO1w4lnU No.36080 Ignore Report Quick Reply
Decomposing an n-ary relationship into binary relationships require us to introduce n-1 surrogate keys and 2n-2 foreign key constraints. That's just nuts, why would you want to do that?

I'm just checking if you get the relational model. In the RM, relationships map to columns in tables, so an n-ary relationship is represented by a table with n components.

I have no idea how LDAP works, but check out Andl for a recently developed database language.

Java Sucks by Nicholas Drorringspear - Sun, 10 Apr 2016 20:14:48 EST ID:W/zS63TD No.35461 Ignore Report Reply Quick Reply
File: 1460333688209.jpg -(23367B / 22.82KB, 320x299) Thumbnail displayed, click image for full size. 23367
Hey, so why would you have an Interface that has an Abstract class as a subclass which then has a normal Class as a subclass of that?
The arrows look like:
Interface <-- Abstract <-- Class

Like, what exactly would the program be gaining by making it so hard to understand like this?
29 posts and 4 images omitted. Click Reply to view.
Doris Puggleford - Thu, 04 Aug 2016 16:17:01 EST ID:m6bw8rZX No.35953 Ignore Report Quick Reply
1470341821194.jpg -(91237B / 89.10KB, 500x661) Thumbnail displayed, click image for full size.
Nope, Eric Evans is the worst thing that happened to software development since goto.
Thomas Fezzlepedging - Fri, 05 Aug 2016 13:00:02 EST ID:9QSfnS0r No.35960 Ignore Report Quick Reply
Point taken.
James Snodbanks - Mon, 08 Aug 2016 10:18:11 EST ID:vIbiteGg No.35975 Ignore Report Quick Reply
I tend to use Go's embeds in other languages. Compose an instance of the derived class and inherit from it then just forward the necessary methods from the composed class. Feels more like actual building blocks than complicated type trees.
Hannah Senningdidge - Mon, 22 Aug 2016 20:51:31 EST ID:e7bTcYy7 No.36048 Ignore Report Quick Reply
At that point you just declare a bunch of type aliases for relevant functions instead of instead of classes.
type FoodUnpacker = FoodBox => FoodIngredients
type FoodCooker = FoodIngredients => CookedFood

Or in java
class FoodUnpacker extends Function<FoodBox, FoodIngredients> {}
class FoodCooker extends Function<FoodIngredients, CookedFood> {}

Fairly legible and nimble there IMO.
Hannah Senningdidge - Mon, 22 Aug 2016 23:05:46 EST ID:e7bTcYy7 No.36052 Ignore Report Quick Reply
sorry, those java classes should be interfaces and may need to forward some members or whatever.

Software Design by Lydia Seblingwell - Fri, 15 Jul 2016 21:14:09 EST ID:F+scHBch No.35856 Ignore Report Reply Quick Reply
File: 1468631649935.jpg -(63471B / 61.98KB, 883x273) Thumbnail displayed, click image for full size. 63471
You know how you download some source, and you have all these directories and header files and class files and this overwhelming complex system of files?

Well my school has taught me how to write short programs that consist of one file, but I want to start building a program and the problem is that I don't know where to begin as far as the design and architecture.

I have a vague idea of design patterns and general OO concepts, but I just don't know where to put what to start out. Is it possible that I could write out a whole function, only to have to re-write it when because I had to changed some other part of the overall design, you know?

So what do you guys recommend? How do you go about designing software?
It's a small CLI program, take inputs, work with files, do operations, print results, etc.
13 posts omitted. Click Reply to view.
James Snodbanks - Mon, 08 Aug 2016 12:28:14 EST ID:vIbiteGg No.35976 Ignore Report Quick Reply
> Imagine you have all these functions, each with unique parameters that can be customized
Standardize those functions to the same signature if they are will all be called from the same menu. You can make them void => void and have them refer to a global variable of the current settings/config but the best would be to pass them the configs as an interface and have them return some result state

trait Config {???}
type Result = Try[???]
type MenuAction = Config => Result
type MenuItem = JButton
type Menu = Map[MenuItem, MenuAction]
var result: Result = myMenu("run")(myConfig)
William Geffingfoot - Mon, 08 Aug 2016 15:39:29 EST ID:34i2KQQ+ No.35977 Ignore Report Quick Reply
The tag is (pre). Alright, so maybe something like this, once I learn how to use function pointers (but if theres a better way, do tell)
map<string, function> options_map; 
if(user_input == options_map.getElement) // lol idk
call that associated function

Which is what you had I think. Don't know what exactly "=>" means though.
Betsy Summlemidge - Fri, 12 Aug 2016 03:14:16 EST ID:Iq5puP1g No.35983 Ignore Report Quick Reply

Let's consider a car as an analogy. A car is a quite complex machine that relies on many different components working in harmony together to function. If any one of the critical components of a car, say the breaks, or the transmission, or the differential, does out the whole car doesn't work. Each one of these components is quite complex on it's own, and probably consists of sever complex sub components. Each component is going to have it's own puzzles and quirks to figure out. You need to be able to focus on a component in isolation or else it will be nearly impossible to tell what's going wrong when you test the whole program. You need to be able to test and revise a given part of your machine/program to the point that you can more or less rely on it. Then you can fit it into the bigger machine and only consider how it fits in, not whether it's acting strangely. Now, of course, probably no code is absolutely perfect, and some of the more frustrating parts of programming is when something you assume is rock solid is fucking up in some non-obvious way, like a library you're depending on. But by unit testing we make coding manageable. Also, you're going to be working in groups. By unit testing you can present something to the wider team they feel confident they can use. Otherwise it's highly likely you'll be wasting people's time with you buggy code.
Eliza Drupperstut - Fri, 12 Aug 2016 16:07:14 EST ID:VAZu238H No.35987 Ignore Report Quick Reply
>the hard coded menu is getting big and hard to maintain
So populate it dynamically.
However, it sounds like something is fucked with you design. Why is there is big ass menu?

The trendy fucks here will tell you it's wrong, but have your commands/menu items inherit from a base class that registers itself with a list that gets build at runtime. Or have a command factory.
James Turveyman - Tue, 16 Aug 2016 10:08:05 EST ID:vIbiteGg No.36010 Ignore Report Quick Reply
I was using scala code. T => R is a function that takes an argument of type T and returns type R. In Java 8 there is the java.util.function package and in that the equivalent classes would be Function<T, R>. There are many classes but they are all specific cases of Function<T, R> or Function<T1, T2, R>.

So in Java it would look something like this
Map<String, Function<Config, Result>> option_map =  new Map<String, Function<Config, Result>>;
option_map.put("Run", (Config c) -> someObject.run(c));
// add more options

then in your main function you could have something like:
Config config  =  //current state;
while (!config.doQuit) {
String user_input = //get user input
Comment too long. Click here to view the full text.

I need some help by George Clibbleworth - Sat, 13 Aug 2016 14:45:03 EST ID:tXYxcME5 No.35992 Ignore Report Reply Quick Reply
File: 1471113903604.png -(453805B / 443.17KB, 2000x2000) Thumbnail displayed, click image for full size. 453805
Guys, I've literally tried everything and nothing works, maybe my level is basic but I really want to finish this project, the real problem is:

Exception in thread "AWT-EventQueue-0" org.hibernate.TransactionException: nested transactions not supported

So my save button can't send the data to mysql :s
Ebenezer Femmerfog - Sat, 13 Aug 2016 14:56:34 EST ID:PWhM8zCd No.35993 Ignore Report Quick Reply
Don't create a new session if an old session is open.
Shit Feddlehood - Sat, 13 Aug 2016 15:09:46 EST ID:VAZu238H No.35995 Ignore Report Quick Reply
The problem is... nested transactions
Shit Feddlehood - Sat, 13 Aug 2016 15:10:47 EST ID:VAZu238H No.35996 Ignore Report Quick Reply
I forgot 420 still mangles ampersands, just copy paste the link or expand thread then click it.

web chat advise needed by Fucking Dibblechere - Mon, 08 Aug 2016 15:46:15 EST ID:sNSHZCqU No.35978 Ignore Report Reply Quick Reply
File: 1470685575726.jpg -(114048B / 111.38KB, 603x604) Thumbnail displayed, click image for full size. 114048
Hey guys, I need you help pretty much!

I need to find a free (preferably) web chat, preferably the one that can be integrated to standard LAMP server, with certain features:

there have to be chat rooms;
there have to be moderators/admins;
moderators/admins should be able to change users' avatars;
users should not be able to change their avatars;
moderators/admins should have invisible mode (optional).

Was trying to google this features, but without success. Hope some experienced good sir will help me with this. Thanks!
Archie Crungermetch - Mon, 08 Aug 2016 19:18:38 EST ID:lPgjzyrL No.35979 Ignore Report Quick Reply

I googled "php mysql chat" and this was the fifth result. Not sure about avatars but it seems to meet all of your other criteria.

You could also use WordPress and a chat room plugin (there are dozens).
Archie Crungermetch - Mon, 08 Aug 2016 19:19:37 EST ID:lPgjzyrL No.35980 Ignore Report Quick Reply
Should probably link the project page, it's more helpful: http://frug.github.io/AJAX-Chat/
Eliza Dupperhick - Tue, 09 Aug 2016 05:56:18 EST ID:sNSHZCqU No.35982 Ignore Report Quick Reply
1470736578560.jpg -(111305B / 108.70KB, 500x686) Thumbnail displayed, click image for full size.
Many thanks, will check it out!

Why does lisp use parantheses? by Fucking Sosslehood - Sat, 30 Jul 2016 20:59:33 EST ID:vKYETtkX No.35930 Ignore Report Reply Quick Reply
File: 1469926773087.png -(52944B / 51.70KB, 1136x640) Thumbnail displayed, click image for full size. 52944
I thought the whole point of prefix (polish) notation was to avoid them.
1 posts omitted. Click Reply to view.
Fucking Sosslehood - Sun, 31 Jul 2016 03:59:54 EST ID:vKYETtkX No.35932 Ignore Report Quick Reply
1469951994087.jpg -(131082B / 128.01KB, 628x880) Thumbnail displayed, click image for full size.
I didn't say it was. I was only wondering why the parans. Pic related. Im gonna try and write a z80 compiler to see what gives.
Eugene Pockgold - Sun, 31 Jul 2016 05:58:00 EST ID:ViDyqkW7 No.35933 Ignore Report Quick Reply
LISP syntax directly represents the parse tree.
Sophie Dartbanks - Sun, 31 Jul 2016 10:50:27 EST ID:WLOo3E7i No.35934 Ignore Report Quick Reply
How is your syntax going to work?
Are you going to use white space, like Python, or are you going to go full polish notation
As Lisp uses s-expressions, where only the atoms are polish notation
Fuck Gobblebury - Mon, 01 Aug 2016 14:57:00 EST ID:VAZu238H No.35936 Ignore Report Quick Reply
LISP syntax directly represents incomprehensible gibberish
William Worthingway - Tue, 02 Aug 2016 11:41:08 EST ID:9QSfnS0r No.35943 Ignore Report Quick Reply
Take a look at factor

It's basically what you get if you write a forth to do everything that a lisp does.
It still uses parenthesis where it makes sense, like for literal arrays and such, but otherwise relies on RPN wherever possible.

As already mentioned forth really only uses rpn, but you end up with stack juggling for most applications.

Phone Interviews by Oliver Sacklepag - Thu, 30 Jun 2016 15:06:54 EST ID:W/zS63TD No.35795 Ignore Report Reply Quick Reply
File: 1467313614568.png -(238398B / 232.81KB, 259x318) Thumbnail displayed, click image for full size. 238398
Well I just failed miserably on a phone interview, but I'm curious as to why HR would ask the question
>what is your favorite programming language and why?
(thats not the question I failed lol)
5 posts and 1 images omitted. Click Reply to view.
Jarvis Smallforth - Sat, 02 Jul 2016 03:26:44 EST ID:W/zS63TD No.35812 Ignore Report Quick Reply
If I dont care about that kind of stuff -> why am I at a university?
Non sequitur. What does caring about discrete math have to do with being at a university?
Eliza Mumbledale - Sun, 03 Jul 2016 16:29:54 EST ID:4AC8OQBZ No.35816 Ignore Report Quick Reply
I'm occasionally a phone-screen interviewer for my company (where I am a professional programmer) and we ask the question, "Please rank your top three programming languages, and go into a little detail about why you placed them where you did". It is deliberate that we do not describe "top" as "most favorite" or "most proficient", but instead whichever one the candidate selects says something about their character.

Also it's always fun when people pick a #2 or #3 programming language that's really out there. One time some guy said that he enjoyed toying around with Conway's Game of Life. We asked him what he meant, and he said that he liked to play around and try and come up with obscure ways to perform basic programming constructs using the Turing-completeness of the GoL CA. Needless to say, that little bit of interesting unexpectedness added an edge to that candidate.

I would imagine that for most companies, they're looking for an answer to your question OP that aligns with the programming languages that they most use at work. So if you say that your favorite programming language is C# and the company doesn't do any C# work, then you may be out of luck in the rest of the interview.
Albert Lightforth - Fri, 29 Jul 2016 07:54:37 EST ID:ebCYLs2f No.35925 Ignore Report Quick Reply
Why choose PHP over Python?
Cyril Huppershit - Fri, 29 Jul 2016 14:36:50 EST ID:2rmkrydG No.35927 Ignore Report Quick Reply
>not using Node.js
Cornelius Brookfield - Fri, 29 Jul 2016 15:54:04 EST ID:VAZu238H No.35929 Ignore Report Quick Reply
>He fell for the javascript meme

I ask you because I like you by Oliver Wucklelug - Wed, 29 Jun 2016 15:39:21 EST ID:sIgWxmPi No.35786 Ignore Report Reply Quick Reply
File: 1467229161198.png -(9121B / 8.91KB, 746x542) Thumbnail displayed, click image for full size. 9121
tl;dr: how to find the point closest to the intersection in pic. The black dots are cartesian points from a list (or two). The circle can be a function, or also a list of points. I'm using python...

Amateur needing some programming for a thesis here.

I have a list of cartesian points (currently two lists, one for x, one for y, but I can do it differently ofc). These points describe a short path of a veichile, arond 10 meters, so it's a uncomplicated curve. I also have a list of points forming a circle derived from points from the aforementioned list(s) (derived means the circle center is not actually one of the points), and a constant radius.
I could also just use a function for the circle I guess.

I want to find the point closest to the intersection. Pic related
7 posts and 2 images omitted. Click Reply to view.
Ernest Greenwill - Wed, 06 Jul 2016 14:13:02 EST ID:PQ13pkX3 No.35820 Ignore Report Quick Reply
Unless you're trying to do this on a microcontroller without enough memory for a lookup table, this is trivial.
Shit Worthinghood - Thu, 07 Jul 2016 15:18:32 EST ID:sIgWxmPi No.35823 Ignore Report Quick Reply
1467919112741.png -(58141B / 56.78KB, 1157x389) Thumbnail displayed, click image for full size.
Yeah, the prototype will probably just use a laptop or similar.
Felt kinda stupid asking that question.


Would this work?:
import math
p2 = (center of the famous red circle)
for point in lista:
math.hypot(p2[0] - %r[0],p2[1] - %r[1])

"lista" is the list of all the 100 most recent cartesian points.
Nathaniel Derringway - Thu, 07 Jul 2016 20:01:08 EST ID:ggSMefJk No.35824 Ignore Report Quick Reply
I don't know wtf %r is supposed to be, but you have the right idea. If this is all you're looking to do, here's one way a civilized person might write this:

def get_min_distance(center, radius, point_list):
solution = (float("inf"), None)

for point in point_list:
distance = math.hypot(center[0] - point[0], center[1] - point[1]) - radius
if distance < solution[0]:
solution = (distance, point)

return solution
William Boblinghick - Mon, 18 Jul 2016 12:36:06 EST ID:sIgWxmPi No.35866 Ignore Report Quick Reply
1468859766408.jpg -(2130467B / 2.03MB, 2204x3920) Thumbnail displayed, click image for full size.
This just picks the point closest to the center and gives me the distance from the center + the radius
I want the closest point to the circle edge.

I've mucked about with it but am at a loss, so, if anyone, please.

Among other things I've tried this:
def get_min_distance(center, radius, point_list):
solution = (float("inf"), None)

for point in point_list:
distance = math.hypot(center[0] - point[0], center[1] - point[1])
if distance < solution[0] - radius:
solution = (distance, point)
Comment too long. Click here to view the full text.
Fanny Greencocke - Mon, 18 Jul 2016 14:34:12 EST ID:WLOo3E7i No.35868 Ignore Report Quick Reply
It looks like >>35824 is pretty close, it just needs the absolute value of the distance
distance = abs(math.hypot(center[0] - point[0], center[1] - point[1]) - radius)

For the line distance < solution[0], solution is a list where the 0th element is the distance from the radius and and 1st element is the point itself

So all it is doing is comparing the distance of the current point with the point that is closest to the radius

<<Last Pages Next>>
0 1 2 3 4 5 6 7 8 9
Report Post
Please be descriptive with report notes,
this helps staff resolve issues quicker.