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
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

weird posted:

it took it over a decade to support c99 at all and it still doesn't support all of it

And people are still writing code against Python 2 and Perl 5 and Fortran 90. I mean, I'd hope for better from Microsoft, but I can't say I'm really surprised either.

Adbot
ADBOT LOVES YOU

fritz
Jul 26, 2003

TooMuchAbstraction posted:

To get multiple return values in C++, you need to put the extra return values into the parameter list for the function, and pass them by reference or by pointer, yes.

http://www.cplusplus.com/reference/utility/pair/ http://www.cplusplus.com/reference/tuple/ :getin:

(not to mention : https://en.wikipedia.org/wiki/Return_value_optimization )

everythingWasBees
Jan 9, 2013




ToxicFrog posted:

You can also just pull in the individual symbols you want, e.g. using std::string; means you can now refer to it as just string but you don't end up with the rest of std all over the place.

I'm a CS student at a school that primarily uses C++, and this will save me so much time. Thank you!

nielsm
Jun 1, 2009



weird posted:

it took it over a decade to support c99 at all and it still doesn't support all of it

And the product is called Visual C++, not Visual C. It just happens to also support the parts of C that are sufficiently similar to C++.

Suspicious Dish
Sep 24, 2011

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

TooMuchAbstraction posted:

And people are still writing code against Python 2 and Perl 5 and Fortran 90.

python 3 is bad and perl 6 doesn't exist.

kznlol
Feb 9, 2013
This is probably the wrong thread but I couldn't find anything that seemed to fit better.

How hard would it be to make something that could spoof mouse input based on the real-world distance of mouse travel? Like say I wanted to consistently spoof moving my mouse X inches horizontally? Or even just measure the real world travel? I've looked for something that would do this for a couple months now and all I can find is things that seem to track mouse pointer movement in real world units.

SurgicalOntologist
Jun 17, 2004

It's not possible in general because if the mouse gets lifted off the desk, you're boned. It also depends on system settings. So, by trial and error you could figure out the gain in physical units (you could write a short calibration routine: "move the mouse 6 inches and click") but you'll never be confident in the position.

If you want to track physical movement you should look into motion tracking technologies. I use it for research and I'm not familiar enough with cheaper, consumer-grade options to recommend one but I know they exist. The wii was supposed to bring motion capture to the masses, then the kinect, but that was like 5 years ago so I'm not sure what the best option is these days.

Edit: oops I was responding to the measure question, not the spoof question. If you just mean moving the cursor as if the mouse has moved X inches, once you've measured the gain with a calibration routine it should be straightforward.

SurgicalOntologist fucked around with this message at 16:35 on May 22, 2016

nielsm
Jun 1, 2009



You have things like pen digitizers, which often also support a mouse accessory, those give you absolute positioning of the pointing device on the digitizer surface.

But if you actually wanted to track an arbitrary object around a space, you would probably have to look into things like triangulation of an RFID tag against multiple receivers etc.


As for actually spoofing input, depends on the OS, but on Windows there is the SendInput function which is the standard way to generate input when you aren't a hardware driver.

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
Keep in mind that movement of the cursor onscreen depends on how quickly the mouse moves. If I move my mouse very slowly, I can cover a foot or two in the time it takes the cursor to traverse the screen; conversely, if I give the mouse a rapid twitch, then I can cross the entire screen in an inch of real-world distance. This depends on your mouse sensitivity settings, but I've no idea how those actually work, whether they're linear or exponential or whatever.

Sedro
Dec 31, 2008

TooMuchAbstraction posted:

Keep in mind that movement of the cursor onscreen depends on how quickly the mouse moves. If I move my mouse very slowly, I can cover a foot or two in the time it takes the cursor to traverse the screen; conversely, if I give the mouse a rapid twitch, then I can cross the entire screen in an inch of real-world distance. This depends on your mouse sensitivity settings, but I've no idea how those actually work, whether they're linear or exponential or whatever.

That's mouse acceleration ('enhance pointer precision' on Windows). The first thing I turn off on any device

Munkeymon
Aug 14, 2003

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



Suspicious Dish posted:

python 3 is bad

oh word?

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Yeah, but Python 2 is far worse because of its stupid, broken text model.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
python 3's text model doesn't even make basic sense though

Thermopyle
Jul 1, 2003

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

Python 3 is fine. And by fine I mean it's broken in a lot of ways, but so is everything in the world.

GameCube
Nov 21, 2006

Is Python 3 so poo poo that someone starting new projects that don't have Python 2-specific package dependencies would still have a reason to prefer 2 over 3? Or is 3 just poo poo enough that it's not worth switching from 2?

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
I haven't done any investigation, but everything I'd heard was "Python 3 is an improvement over Python 2, but there's still major third-party libraries that aren't available in 3 yet so everyone's still writing against 2", and it's been like that for years. Albeit, presumably the number of major libraries that aren't available in Python 3 has been slowly decreasing.

Thermopyle
Jul 1, 2003

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

GameCube posted:

Is Python 3 so poo poo that someone starting new projects that don't have Python 2-specific package dependencies would still have a reason to prefer 2 over 3? Or is 3 just poo poo enough that it's not worth switching from 2?

Well, I'm going to say you should just use 3 if you don't have dependencies on 2. Then someone else is going to go "yeah, but this and this and this is broken on 3" and then I'm going to go "yeah, but this and this and this is broken on 2" and then blah blah blah.

TooMuchAbstraction posted:

I haven't done any investigation, but everything I'd heard was "Python 3 is an improvement over Python 2, but there's still major third-party libraries that aren't available in 3 yet so everyone's still writing against 2", and it's been like that for years. Albeit, presumably the number of major libraries that aren't available in Python 3 has been slowly decreasing.

A few years ago I was still hitting lots of major libraries that were not Python 3 compatible. A couple years ago, there were major libraries that were not compatible, but not every project needs every major library. A year ago 75% of the time you didn't even have to think about whether you'd need to use 2. Nowadays, you can probably default to 3.



The thing with Python is that it gets overused because for people with whom python "clicks", it "clicks" so well that you want to use it for everything.

edit: Actually, Python has had all of its problems fixed.

quote:

  • No floating point numbers, only integers. America never does anything halfway.
  • All numbers must be strictly greater than 1 million. The small stuff is inconsequential to us.
  • There are no import statements allowed. All code has to be home-grown and American made.
  • Instead of True and False, we have fact and lie.
  • Only the most popular English words, Trump's favorite words, and current politician names can be used as variable names.
  • Error messages are mostly quotes directly taken from Trump himself.
  • All programs must end with America is great.
  • Our language will automatically correct Forbes' $4.5B to $10B.
  • In its raw form, TrumpScript is not compatible with Windows, because Trump isn't the type of guy to believe in PC.
  • TrumpScript boycotts OS X and all Apple products until such time as Apple gives cellphone info to authorities regarding radical Islamic terrorist couple from Cal.
  • The language is completely case insensitive.
  • If the running computer is from China or Mexico, TrumpScript will not compile. We don't want them stealing our American technological secrets.
  • Warns you if you have any Communists masquerading as legitimate "SSL Certificates" from China on your system.
  • Won't run in root mode because America doesn't need your help being great. Trump is all we need.
  • Easy to type with small hands

Thermopyle fucked around with this message at 19:10 on May 23, 2016

BigRedDot
Mar 6, 2008

TooMuchAbstraction posted:

I haven't done any investigation, but everything I'd heard was "Python 3 is an improvement over Python 2, but there's still major third-party libraries that aren't available in 3 yet so everyone's still writing against 2"

This is basically not true at all anymore, the only single example of a major python 2 library I can think of is gevent. I switched to python 3 a year ago for my default and it was a complete non-event.

Edit: It's not even true for gevent anymore.

BigRedDot fucked around with this message at 04:02 on May 24, 2016

Star War Sex Parrot
Oct 2, 2003

I must not use Python enough because I don't even know what version I've used in the past.

Peristalsis
Apr 5, 2004
Move along.
With MS Office, one can make applications based on the underlying tool. For example, you can make entry screens for Excel Spreadsheets, and presumably you can make complete database applications with MS Access.

Is there any similar functionality with Google Docs? Could I make a web-enabled app that interacts with peoples' calendars, email, and a simple Google Docs database or spreadsheet?

Munkeymon
Aug 14, 2003

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



You mean use their API? https://developers.google.com/sheets/

Peristalsis
Apr 5, 2004
Move along.

Perhaps, thanks!

man in the eyeball hat
Dec 23, 2006

Capture the opening of the portal that connects this earth of 3D to one earth of 4D or 5D. Going to the 5D.

I have an idea for a programming/web dev project, but I'm unsure where to start for the web portion.

High-level, I want to create a website where users can upload files and associate some tags/a description with these files (files are on the order of 1 MB max, probably closer to 50 kB more typically). I then want a client-side program that can fetch these files from the server and do something with the files.

I need help figuring out where to start for developing the web portion. I've never done any web development/web work (beyond HTML/CSS for a personal website), let alone a website which allows third parties to upload files, so I'm clueless what the relevant libraries/programs/etc are. Usage will be happening on desktops/laptops (no mobile development necessary, currently). I'd like some advice in what technologies to look into for safely and correctly creating a server/database for users to upload these files with some associated metadata, and preferably something that's easily interfaced with from a programming language (C++ or Python are preferred, as I'm comfortable with them).

E- all the clientside stuff, working with the file after I've downloaded it from the server, I'm good with. It's just all the interfacing with the server/the database itself that I need help with

man in the eyeball hat fucked around with this message at 02:45 on May 25, 2016

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
You want Python? Look into Django. It's pretty easy to set up and has all the bells and whistles you'd expect from a modern web framework. Database-wise you can get started using SQLite in like two lines of config, and easily transfer your schemas (if not necessarily your data) to more appropriate databases once you're ready. Like, switching from SQLite to an Amazon S3 PostGresQL database should just be a matter of changing your Django configuration.

KernelSlanders
May 27, 2013

Rogue operating systems on occasion spread lies and rumors about me.
Django's great but really heavy. It's worth looking into, but I'd check out Flask as well.

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

TooMuchAbstraction posted:

And people are still writing code against Python 2 and Perl 5 and Fortran 90.

I think you mean Fortran 77. Because Fortran 90 is a definitive improvement (hello structured programming!) which makes it a... somewhat decent language in my opinion.

But there's a shitton of legacy code in f77 and it's an absolute nightmare.

Fortran 95 and beyond is like uh... not necessarily bad but seriously who cares about doing OOP in loving fortran lol

Thermopyle
Jul 1, 2003

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

KernelSlanders posted:

Django's great but really heavy. It's worth looking into, but I'd check out Flask as well.

Flask is great and useful, but Django being "heavy" is, most of the time, not a reason to switch to Flask.

For most projects over most projects lifespans, there's no cost to the batteries-included nature of Django.

man in the eyeball hat
Dec 23, 2006

Capture the opening of the portal that connects this earth of 3D to one earth of 4D or 5D. Going to the 5D.

Read some quick stuff on Flask, looks easier than I expected. When I get a chance I'll look into Django as well. On the whole seems easier than I anticipated, just need to set up an old computer for a server and get to toying with this to figure things out. Web dev seems really intimidating to start.

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

Zlocista posted:

I have an idea for a programming/web dev project, but I'm unsure where to start for the web portion.

High-level, I want to create a website where users can upload files and associate some tags/a description with these files (files are on the order of 1 MB max, probably closer to 50 kB more typically). I then want a client-side program that can fetch these files from the server and do something with the files.

I need help figuring out where to start for developing the web portion. I've never done any web development/web work (beyond HTML/CSS for a personal website), let alone a website which allows third parties to upload files, so I'm clueless what the relevant libraries/programs/etc are. Usage will be happening on desktops/laptops (no mobile development necessary, currently). I'd like some advice in what technologies to look into for safely and correctly creating a server/database for users to upload these files with some associated metadata, and preferably something that's easily interfaced with from a programming language (C++ or Python are preferred, as I'm comfortable with them).

E- all the clientside stuff, working with the file after I've downloaded it from the server, I'm good with. It's just all the interfacing with the server/the database itself that I need help with

If you are going the SPA route, or don't want to write a backend for this, you can look at services like Firebase and FileStack. Firebase will handle your hosting, authentication, authorization, and any sort of NoSQL database stuff you might want, and FileStack will do a similar thing but for uploading large files.

SurgicalOntologist
Jun 17, 2004

Has anyone encountered data in a .pam file? Apparently it's some kind of image format but this is supposed to be positional data picked up from a motion-capture camera system. It could easily be that I was sent the wrong file or its some propriety format. The people I'm dealing with are like three steps removed from the actual technology that created it. I don't want to go back to them unless I really have to.

All I can tell is that it's binary but I'm not really sure how to guess at the format. If I load it into Python I get a bunch of bytes interspersed with strings (that make sense). In the header at least, in the rest of the file it's all bytes. I assume they're floats of some kind but I'm not sure what to try next. The only time I've dealt with binary files was when communicating with some hardware over a serial port and the manual told me exactly what bytes did what.

So, is there any chance of reverse-engineering this without knowing any more, or do I tell my contact to scour whatever crappy software they use for an export option?

Sinestro
Oct 31, 2010

The perfect day needs the perfect set of wheels.

SurgicalOntologist posted:

Has anyone encountered data in a .pam file? Apparently it's some kind of image format but this is supposed to be positional data picked up from a motion-capture camera system. It could easily be that I was sent the wrong file or its some propriety format. The people I'm dealing with are like three steps removed from the actual technology that created it. I don't want to go back to them unless I really have to.

All I can tell is that it's binary but I'm not really sure how to guess at the format. If I load it into Python I get a bunch of bytes interspersed with strings (that make sense). In the header at least, in the rest of the file it's all bytes. I assume they're floats of some kind but I'm not sure what to try next. The only time I've dealt with binary files was when communicating with some hardware over a serial port and the manual told me exactly what bytes did what.

So, is there any chance of reverse-engineering this without knowing any more, or do I tell my contact to scour whatever crappy software they use for an export option?

There may be no need. In addition, there's an already written library with support for this, PyPNG supports it (apparently).

Sinestro fucked around with this message at 00:11 on May 26, 2016

SurgicalOntologist
Jun 17, 2004

Wow that was fast, thanks. I guess my google-fu is weak today.

Dren
Jan 5, 2001

Pillbug

SurgicalOntologist posted:

Has anyone encountered data in a .pam file? Apparently it's some kind of image format but this is supposed to be positional data picked up from a motion-capture camera system. It could easily be that I was sent the wrong file or its some propriety format. The people I'm dealing with are like three steps removed from the actual technology that created it. I don't want to go back to them unless I really have to.

All I can tell is that it's binary but I'm not really sure how to guess at the format. If I load it into Python I get a bunch of bytes interspersed with strings (that make sense). In the header at least, in the rest of the file it's all bytes. I assume they're floats of some kind but I'm not sure what to try next. The only time I've dealt with binary files was when communicating with some hardware over a serial port and the manual told me exactly what bytes did what.

So, is there any chance of reverse-engineering this without knowing any more, or do I tell my contact to scour whatever crappy software they use for an export option?

You already kinda have an answer but did you run file on it to determine more info about the file type? Your description of "a bunch of bytes interspersed with strings" is typical of many file formats.

SurgicalOntologist
Jun 17, 2004

Hmm maybe that's not it because the header doesn't seem to match the format described in that spec. I'll see if PyPNG can make sense of it.

file just returns 'data'.

feedmegin
Jul 30, 2008

Symbolic Butt posted:

I think you mean Fortran 77. Because Fortran 90 is a definitive improvement (hello structured programming!) which makes it a... somewhat decent language in my opinion.

But there's a shitton of legacy code in f77 and it's an absolute nightmare.

Fortran 95 and beyond is like uh... not necessarily bad but seriously who cares about doing OOP in loving fortran lol

Let me tell you about object-oriented COBOL!

(Yes, actually a thing - https://supportline.microfocus.com/documentation/books/sx51/oppubb.htm)

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

I'm making a little Arkanoid game in Javascript. I store the level in a 10x10 array of arrays like so

code:
  var bricks = [ 
  ['0','0','0','0','0','0','0','0','0','0'],
  ['0','0','0','0','0','0','0','0','0','0'],
  ['1','2','3','4','5','1','2','3','4','5'],
  ['2','3','4','5','1','2','3','4','5','1'],
  ['3','4','5','1','2','3','4','5','1','2'],
..
..
Now I've gotten to the point where I want to start adding some features like bricks being able to take multiple hits, and a power-up hiding behind the brick. I could simply create another array for power-ups, and another array for 'brick health' or something like that, but I'd like to keep it in one array and have it easily editable by hand.

If I were going to be making 150 levels or something I'd make a little level editor and store something like { color: 'blue', strength: '3', powerup: 'none' } in each array location.

But what I'm wondering is what would be a handy way to store 3 values in one variable? Years and years ago when I did this in Turbo Pascal I just used used a 16-bit value and used the first 4 bits for one value, the next 4 for the next... and then I just did the values like $082a, and that meant power up #8, brick takes 2 hits to break, and is sprite # 10

I thought about just using a 3 digit # like 1028. I can / by 100 to get the sprite #, / 10 to get the strength, and then what's left to get the power up #. I want something I can use a fixed length for so that the map array stays human-readable.

Any other suggestions?

IT BEGINS
Jan 15, 2009

I don't know how to make analogies

Bob Morales posted:

But what I'm wondering is what would be a handy way to store 3 values in one variable? Years and years ago when I did this in Turbo Pascal I just used used a 16-bit value and used the first 4 bits for one value, the next 4 for the next... and then I just did the values like $082a, and that meant power up #8, brick takes 2 hits to break, and is sprite # 10

You could use an array to store it, which would stretch it out a bit but keep it human-readable. Otherwise I think the 3-digit # idea is solid because you're probably not going to have more than 10 of each value type.

If you're looking for more complexity, you could keep a map of brick types for one level and a separate map describing which bricks go where. So if your first level has only 3 types of bricks you'd have something like:

code:
var brick_types = {
    '0': { color: 'blue', strength: 1, power-up: 'none' },
    '1': { color: 'red', strength: 2, power-up: 'none' },
    '2': { color: 'red', strength: 2, power-up: 'laser' },
}

var bricks = [
    ['0','0','0','0','0','0','0','0','0','0'],
    ['0','1','1','1','2','2','1','1','1','0'],
]
This gives you 62 brick types per level just between 0-9A-Za-z.

IT BEGINS fucked around with this message at 15:33 on May 27, 2016

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

Bob Morales posted:

I'm making a little Arkanoid game in Javascript. I store the level in a 10x10 array of arrays like so

code:
  var bricks = [ 
  ['0','0','0','0','0','0','0','0','0','0'],
  ['0','0','0','0','0','0','0','0','0','0'],
  ['1','2','3','4','5','1','2','3','4','5'],
  ['2','3','4','5','1','2','3','4','5','1'],
  ['3','4','5','1','2','3','4','5','1','2'],
..
..
Now I've gotten to the point where I want to start adding some features like bricks being able to take multiple hits, and a power-up hiding behind the brick. I could simply create another array for power-ups, and another array for 'brick health' or something like that, but I'd like to keep it in one array and have it easily editable by hand.

If I were going to be making 150 levels or something I'd make a little level editor and store something like { color: 'blue', strength: '3', powerup: 'none' } in each array location.

But what I'm wondering is what would be a handy way to store 3 values in one variable? Years and years ago when I did this in Turbo Pascal I just used used a 16-bit value and used the first 4 bits for one value, the next 4 for the next... and then I just did the values like $082a, and that meant power up #8, brick takes 2 hits to break, and is sprite # 10

I thought about just using a 3 digit # like 1028. I can / by 100 to get the sprite #, / 10 to get the strength, and then what's left to get the power up #. I want something I can use a fixed length for so that the map array stays human-readable.

Any other suggestions?

You can have the map straight up just be an array of all brick objects. You are just making your life hard trying to map them to some template and then match by strings. Don't try doing some weird math to fit values into a 16bit number... you can't even HAVE 16bit numbers in JavaScript, ALL numbers are 64bits.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

I don't know much javascript, but can't you put a structure or object reference in the array? Using an integer split up into fields feels like 1991 C. (not that it won't work)

Adbot
ADBOT LOVES YOU

feedmegin
Jul 30, 2008

Skandranon posted:

You can have the map straight up just be an array of all brick objects. You are just making your life hard trying to map them to some template and then match by strings. Don't try doing some weird math to fit values into a 16bit number... you can't even HAVE 16bit numbers in JavaScript, ALL numbers are 64bits.

And floating point at that, if I recall.

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