Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
LOOK I AM A TURTLE
May 22, 2003

"I'm actually a tortoise."
Grimey Drawer
Does anyone know the name of and/or a non-brute force algorithm for this problem? It's similar to the knapsack problem and the bin packing problem. It might be the multiple knapsack problem?

Given two lists A and B of equal length, with each item in each list being an N-tuple, find the ordering(s) for A such that as many numbers as possible in A are larger than or equal to the corresponding number in B. A tie counts as half of a win.

Example:

A: [(1, 2), (3, 4), (5, 6)]
B: [(2, 3), (1, 5), (4, 6)]

The best ordering of A here is either [(3, 4), (1, 2), (5, 6)] or [(3, 4), (5, 6), (1, 2)], both giving 4 points.

Adbot
ADBOT LOVES YOU

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


That sounds like an instance of the assignment problem.

Henry Black
Jun 27, 2004

If she's not making this face, you're not doing it right.
Fun Shoe
This is only slightly related: is there somewhere/a thread I can offer up a small programming job for cash? I need something doing with Javascript.

Mr Shiny Pants
Nov 12, 2012

Henry Black posted:

This is only slightly related: is there somewhere/a thread I can offer up a small programming job for cash? I need something doing with Javascript.

Try this: https://forums.somethingawful.com/showthread.php?threadid=3246449

Shy
Mar 20, 2010

Post it on freelancer.com, there's no lower limit even if the task is very small and cheap.

Capri Sun Tzu
Oct 24, 2017

by Reene
That thread is archived, SA-Mart might be a good choice. Post a thread there and link it here for more exposure

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. Bertrand Russell

Start a new thread here in COBOL.

hooah
Feb 6, 2006
WTF?
Not really programming per se, but I couldn't find a better place. With Sublime Text 3, is there a way to disable the lorem ipsum text completion?

underage at the vape shop
May 11, 2011

by Cyrano4747
I have a question about basic operations and algorithm order of growth.

So this is my algorithm that I have to test:


I would assume that the basic operation here is the comparison at the start, and because it's done exactly once for each index of the array, that the order of growth would be N. I decided to test it to be sure and I found that it isn't



Am I missing something here?

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

underage at the vape shop posted:

I have a question about basic operations and algorithm order of growth.

So this is my algorithm that I have to test:


I would assume that the basic operation here is the comparison at the start, and because it's done exactly once for each index of the array, that the order of growth would be N. I decided to test it to be sure and I found that it isn't



Am I missing something here?

Dunno what to tell you. Possibly you're benefiting from some kind of runtime optimizations? What language are you using?

Python code:
import random
import time

for n in [100, 1000, 10000, 100000, 1000000, 10000000]:
  ns = [random.randint(-1000, 1000) for i in xrange(n)]
  start = time.time()
  i = 0
  j = n - 1
  while i <= j:
    if ns[i] < 0:
      i += 1
    else:
      ns[i], ns[j] = ns[j], ns[i]
      j -= 1
  end = time.time()
  print("%d: %.4fs" % (n, end - start))

output posted:

100: 0.0001s
1000: 0.0004s
10000: 0.0037s
100000: 0.0393s
1000000: 0.4135s
10000000: 3.8523s

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
That is an asympotically linear growth curve. Its understood that wall-clock measurements wont necessarily match the curve for small N, for all sorts of fixed-overhead reasons like the time spent waiting for the code to load from disk.

Your argument probably needs to be stronger than once for every element in the array, though, since its not like the code is obviously advancing through the array one element at a time.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



hooah posted:

Not really programming per se, but I couldn't find a better place. With Sublime Text 3, is there a way to disable the lorem ipsum text completion?

Have you tried setting auto_complete to false?

hooah
Feb 6, 2006
WTF?

Munkeymon posted:

Have you tried setting auto_complete to false?

No, because I want auto-complete.

Careful Drums
Oct 30, 2007

by FactsAreUseless
Destroy all software is free this week and subs are discounted. Has anyone here watched them? Would you recommend watching them?

https://www.destroyallsoftware.com/sale

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I've watched a handful or two, theyre great. Youre watching someone good do their work, so youll learn something (or be reminded of something youve forgotten) even if the exact code on the screen isnt particularly novel or relevant to you.

Hes good on twitter too, if thats something you partake in.

mike12345
Jul 14, 2008

"Whether the Earth was created in 7 days, or 7 actual eras, I'm not sure we'll ever be able to answer that. It's one of the great mysteries."





I'm interested in creating a kind of diy plotter, basically a machine that uses a pen to draw shapes or images. What language and dev kits would I need to learn/acquire to make that possible? I'm new to coding and only got a year experience in Lisp, but I'm getting curious about C so maybe that would be a good start? I heard C is used in robotics, that's why.

e: don't really care if there's a (cheap) machine out there that lets me do this, this is more of a learning project.

nielsm
Jun 1, 2009



Do you want to focus more on the software or on the hardware? How much do you know about electronics already?

The "easy way out" would probably be a Raspberry Pi, install a Linux on it, and control stepper motors via the GPIO. You can do that in mostly any language you want, but C or Rust as low-level languages would give you the best timing guarantees.

The somewhat more involved way would be with an Arduino kit (or a clone), in which case you'll almost definitely be writing C or assembly. You will probably also need to work out how to get the plotting data over to the device, since you don't have much working memory on those, it's almost real embedded development.

But ask over in the DIY forum, they know more about it. Here's some suggested threads:
https://forums.somethingawful.com/showthread.php?threadid=3505424 Arduino thread
https://forums.somethingawful.com/showthread.php?threadid=3365193 3D printers thread (a plotter it almost the same, just with fewer motors)
https://forums.somethingawful.com/showthread.php?threadid=2734977 Learning electronics megathread
https://forums.somethingawful.com/showthread.php?threadid=3500975 Embedded development (here in CoC)

nielsm fucked around with this message at 11:42 on Apr 4, 2018

mike12345
Jul 14, 2008

"Whether the Earth was created in 7 days, or 7 actual eras, I'm not sure we'll ever be able to answer that. It's one of the great mysteries."





nielsm posted:

Do you want to focus more on the software or on the hardware? How much do you know about electronics already?

Next to nothing. I guess focusing on the software-side is enough for the start. I assumed it's an easy project for a first-timer.

nielsm posted:

The "easy way out" would probably be a Raspberry Pi, install a Linux on it, and control stepper motors via the GPIO. You can do that in mostly any language you want, but C or Rust as low-level languages would give you the best timing guarantees.

The somewhat more involved way would be with an Arduino kit (or a clone), in which case you'll almost definitely be writing C or assembly. You will probably also need to work out how to get the plotting data over to the device, since you don't have much working memory on those, it's almost real embedded development.

But ask over in the DIY forum, they know more about it. Here's some suggested threads:
https://forums.somethingawful.com/showthread.php?threadid=3505424 Arduino thread
https://forums.somethingawful.com/showthread.php?threadid=3365193 3D printers thread (a plotter it almost the same, just with fewer motors)
https://forums.somethingawful.com/showthread.php?threadid=2734977 Learning electronics megathread
https://forums.somethingawful.com/showthread.php?threadid=3500975 Embedded development (here in CoC)

Yeah, my first thought was Arduino and C. But that comment with the plotting data and the limited memory is interesting, guess I'll have to consider that. Will definitely check the other threads.

Master_Odin
Apr 15, 2010

My spear never misses its mark...

ladies
Currently at work we're using a bespoke solution to start/stop and watch processes that are running on several different machines. This is all done via a web interface (and by watch, I mean we can see what's getting put out on stdout/stderr for that application) that sits on one of the computers. There's enough things we want changed, I've been trying to see if there are already any existing products in this space. Ideally it'd be able to run and manage processes on Windows as well as Linux (our current solution only supports Linux). We're using this to manage applications that have been written in Python, C++, and Node. The closest I've found is something like pm2 but it seems aimed only for Node, doesn't have a way to look at a programs stdout/stderr and I don't need anything to do with load balancing.

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

mike12345 posted:

I'm interested in creating a kind of diy plotter, basically a machine that uses a pen to draw shapes or images. What language and dev kits would I need to learn/acquire to make that possible? I'm new to coding and only got a year experience in Lisp, but I'm getting curious about C so maybe that would be a good start? I heard C is used in robotics, that's why.

e: don't really care if there's a (cheap) machine out there that lets me do this, this is more of a learning project.

Comedy option: make a real-life LOGO turtle.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. Bertrand Russell

I've been wanting to get more into ML stuff for a long time but haven't ever had a project to spur me into getting the learning done. Well now I think I have one.

For a nerdy home automation thingy I'm wanting to use some raspberry pis with camera modules to recognize when I'm in different rooms of my house.

Can recognizing specific faces (not just faces in general) in video be done on a pi in real time? I guess another option is I can send video from the cameras to my i5-based home server. Or maybe if the pi is good enough to recognize faces in general it can send snapshots of recognized faces to my home server for recognition...

Star War Sex Parrot
Oct 2, 2003

Youd probably want to train the network on your PC, but the classifier will probably run on a Pi.

Edit: saw this the other day. Not exactly what youre doing but should inform what the Pi is capable of

https://medium.com/nanonets/how-to-easily-detect-objects-with-deep-learning-on-raspberrypi-225f29635c74

Star War Sex Parrot fucked around with this message at 17:28 on Apr 4, 2018

dirby
Sep 21, 2004


Helping goons with math
Since the functional programming thread is dead and archived, did anyone here go from Haskell to Purescript? They seem similar enough that it will be easy but I'm a little woried about the lack of laziness biting me.

Asymmetrikon
Oct 30, 2009

I believe you're a big dork!
I didn't go from Haskell to Purescript, but I did go from Haskell to Idris (which is eager) and I didn't really notice any gotchas.

mike12345
Jul 14, 2008

"Whether the Earth was created in 7 days, or 7 actual eras, I'm not sure we'll ever be able to answer that. It's one of the great mysteries."





TooMuchAbstraction posted:

Comedy option: make a real-life LOGO turtle.

Yeah, someone already did this.

feedmegin
Jul 30, 2008

TooMuchAbstraction posted:

Comedy option: make a real-life LOGO turtle.

Logo literally started off with a real-life turtle, of course, that thing wasn't a metaphor. I'm not sure how useful learning sort-of-FORTH would be for today's embedded world, mind you, it's not 1975 any more.

mystes
May 31, 2006

The 2018-appropriate version would be using GraphQL to talk to an IOT device that controls a living turtle via brain stimulation

edit: this is what happens when you watch Black Mirror

mystes fucked around with this message at 16:12 on Apr 5, 2018

Portland Sucks
Dec 21, 2004
༼ つ ◕_◕ ༽つ
I'm going to be in the position of needing to redesign a major software platform at work and I'm lacking in some understanding regarding how well designed real time systems work behind the scenes. We have an application that currently just uses a MSSQL Server database as it's backend, the desktop application itself keeps an in memory snapshot of it's current state, and then just has some really poorly written HasChanged() methods to look at the state of the database compared to its cache to determine if another client changed it within X amount of time. It's a horrible mess of race conditions and collisions and requires a lot of supervision.

I've been looking at various messaging and queue systems (RabbitMQ, Kafka, 0MQ, etc.) and I get the feeling that they were designed for use cases like this. Are there any pretty standard references or design patterns in regards to how systems like this are generally setup? Like how should the communication pathways be designed at the high level, how is long term storage handled, how to work with race conditions, etc. would be very helpful.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

feedmegin posted:

Logo literally started off with a real-life turtle, of course, that thing wasn't a metaphor. I'm not sure how useful learning sort-of-FORTH would be for today's embedded world, mind you, it's not 1975 any more.

Wait, really? That's not what I've read. Mindstorms mentions that the LOGO turtle was designed as such so kids could anthropomorphise it and "pretend they are the turtle" to solve problems, but never that it was a physical device.

Capri Sun Tzu
Oct 24, 2017

by Reene

Suspicious Dish posted:

Wait, really? That's not what I've read. Mindstorms mentions that the LOGO turtle was designed as such so kids could anthropomorphise it and "pretend they are the turtle" to solve problems, but never that it was a physical device.
Yeah they're old robots from the 40's

peepsalot
Apr 24, 2007

PEEP THIS...
BITCH!

Suspicious Dish posted:

Wait, really? That's not what I've read. Mindstorms mentions that the LOGO turtle was designed as such so kids could anthropomorphise it and "pretend they are the turtle" to solve problems, but never that it was a physical device.
LEGO didn't invent LOGO

The Fool
Oct 16, 2003


Suspicious Dish posted:

Wait, really? That's not what I've read. Mindstorms mentions that the LOGO turtle was designed as such so kids could anthropomorphise it and "pretend they are the turtle" to solve problems, but never that it was a physical device.

This post makes me feel old.

vv- e: multiple people making the same mistake

The Fool fucked around with this message at 17:41 on Apr 5, 2018

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

peepsalot posted:

LEGO didn't invent LOGO

Mindstorms is a book by the logo dude.

double riveting
Jul 5, 2013

look at them go

Master_Odin posted:

solution to start/stop and watch processes that are running on several different machines. [...] we can see what's getting put out on stdout/stderr for that application [...] Ideally it'd be able to run and manage processes on Windows as well as Linux [...] I don't need anything to do with load balancing.

Have you considered using something designed for botnets? I am only half joking. :pervert:

edit: I guess in generall, your search keyword would be orchestration, but I'm afraid that's completely overloaded with cloud and virtualization bullshit now.

double riveting fucked around with this message at 18:30 on Apr 5, 2018

Ghost of Reagan Past
Oct 7, 2003

rock and roll fun

Thermopyle posted:

I've been wanting to get more into ML stuff for a long time but haven't ever had a project to spur me into getting the learning done. Well now I think I have one.

For a nerdy home automation thingy I'm wanting to use some raspberry pis with camera modules to recognize when I'm in different rooms of my house.

Can recognizing specific faces (not just faces in general) in video be done on a pi in real time? I guess another option is I can send video from the cameras to my i5-based home server. Or maybe if the pi is good enough to recognize faces in general it can send snapshots of recognized faces to my home server for recognition...
The flow I would go for is that you have a face detection system on the Pi that takes pictures of every face visible to it (on an interval, maybe using OpenCV facial detection?), and pitches the picture to your home server for running through a trained model. I suggest using scikit-learn for your task. A Pi is probably powerful to do both, but I prefer this kind of workflow because it separates the two problems into two discrete tasks. I would in any event write it as two applications generally, the recognition application running as an HTTP server (likely with Flask), even if it runs on the Pi as well. The issue is that you're going to do a bunch of image processing, which can be complicated and computationally intensive.

Ghost of Reagan Past fucked around with this message at 02:26 on Apr 6, 2018

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. Bertrand Russell

Ghost of Reagan Past posted:

The flow I would go for is that you have a face detection system on the Pi that takes pictures of every face visible to it (on an interval, maybe using OpenCV facial detection?), and pitches the picture to your home server for running through a trained model. I suggest using scikit-learn for your task. A Pi is probably powerful to do both, but I prefer this kind of workflow because it separates the two problems into two discrete tasks. I would in any event write it as two applications generally, the recognition application running as an HTTP server (likely with Flask), even if it runs on the Pi as well. The issue is that you're going to do a bunch of image processing, which can be complicated and computationally intensive.

Cool, this is very similar to what I've got sketched out now. It's good to hear someone who sounds like they know what they're talking about saying that maybe I'm not barking up the wrong tree.

Which reminds me...I too-often forget to say thanks when someone helps me because the thread has moved on to something else by the time my bookmarks list tells me there's new posts, so:


Star War Sex Parrot posted:

You’d probably want to train the network on your PC, but the classifier will probably run on a Pi.

Edit: saw this the other day. Not exactly what you’re doing but should inform what the Pi is capable of

https://medium.com/nanonets/how-to-easily-detect-objects-with-deep-learning-on-raspberrypi-225f29635c74

Thanks! That got me on the right path. Well maybe not, we'll see, but it feels like it helped!

ToxicFrog
Apr 26, 2008


hooah posted:

No, because I want auto-complete.

What do you mean by "lorem ipsum autocomplete", then?

feedmegin posted:

Logo literally started off with a real-life turtle, of course, that thing wasn't a metaphor. I'm not sure how useful learning sort-of-FORTH would be for today's embedded world, mind you, it's not 1975 any more.

LISP, not Forth.

hooah
Feb 6, 2006
WTF?

ToxicFrog posted:

What do you mean by "lorem ipsum autocomplete", then?

I mean when I type "l", I want the auto-complete to suggest a word I've actually typed, instead of a block of dummy text.

Ranzear
Jul 25, 2013

I use ST3 on the daily and have never seen lorem ipsum come up in completion. Just tried with a few different syntaxes and a blank new file and it doesn't come up. What syntax do you have set? You sure it's not some installed package?

Adbot
ADBOT LOVES YOU

Capri Sun Tzu
Oct 24, 2017

by Reene

Ranzear posted:

I use ST3 on the daily and have never seen lorem ipsum come up in completion. Just tried with a few different syntaxes and a blank new file and it doesn't come up. What syntax do you have set? You sure it's not some installed package?
Type L then press CTRL+Space

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply