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
the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





Avenging Dentist posted:

Generally, I think it's best to pick one style and use it for both variables and methods. It just makes things more consistent.

i use underscore_deliminated_method_names and CamelCaseVariableNames generally. in some languages it's extremely nice to be able to differentiate between the two at a glance.

Adbot
ADBOT LOVES YOU

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





Coconut Pete posted:

This is not exactly a programming question, but it is related to programming:

If you are contracted to build a web application, say a CMS or whatever, how do you feel about building it with a framework, such as CodeIgniter for PHP or Django or whatever, not counting if the client specifically requests it?

I've always kind of wondered, do you use CodeIgniter, or since you are selling the application as your own to the client, should you write all of the code by hand? Is using a framework "cheating" when selling an application?

Do you write your own language and libraries when you contract? Of course it's not cheating.

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





Is there a cross platform way to get the rgb value of a specific pixel displayed on screen?

The pixel may not be constrained to a certain window, unfortunately. I also need a solution that doesn't rely on dumping screenshots. Language doesn't really matter, but C or Python would be ideal. I also don't really care about OSX, but it would be nice if it worked there too.

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





JoeNotCharles posted:

PyQt (or use the C++ version directly if you have problems with the Python wrapper). Works on Qt, Mac and Linux. I'm not sure what you mean by "dumping screenshots", but I assume you mean you can't save it to an image on disk and then look at the image. The following code will grab the entire screen into a QPixmap in memory and then you get the individual pixel value:

code:
QPixmap::grabWindow(QApplication::desktop().winId()).toImage().pixel(x, y);

This is fantastic, thankyou!

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





This is probably more a question for 'Ask General Programming Questions Worth Their Own Doctoral Thesis' but any recommendations on where to start researching ways to compare two sets for equality? (Assuming you can cache whatever information you want as the sets are constructed). Failing that, a proof that you can't do better than iterating over each member of each set?

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





ShoulderDaemon posted:

Do you have any more context? There are ways you can design your set representation to make inequalities likely to be detected earlier rather than later in the most common cases for your problem, and there are representations that depend on some degree of observable sharing which can change your decision algorithm from O(n) in the number of elements in the list to O(n) in the number of modifications made to the two lists since the last time you confirmed they were equal, although in practice few people care to use these except for rare cases such as infinite sets.

Dense sets can be checked for equality in constant time. Consequently, if you are dealing with disjoint unions of dense sets, you can reduce to O(n) in the number of dense subsets with the right representation.

More practically, it's often possible to derive quick lemmas about what kinds of modifications are possible, and check only restricted subsets for equality.

If your representation is the naive sorted-list representation of a list, and you have no prior information to base your test on, then the proof that testing for equality is O(n) is rather trivial; the complexity of list equality is typically taught as part of any introduction to complexity class in a CS program.

I was criminally vague initially. Sorry. This is what I really want:

I've got two systems, completely distinct from one another. They're organized as sets of nodes containing various state. Right now, we're using a tree representation (merkel trees) to calculate a single hash of the state of each system we can compare trivially. However, this restricts us to having systems with identical internal organization. If any state is moved from one node to another, or the number of nodes changes, the hashes now represent the same state, but are distinct and non comparable.

I know there are O(n) algorithms to calculate this state, but O(n) is, unfortunately, too much overhead (as N is very large when discussing the entire set).

What I really need is a hash function such that hash(A, hash(B, hash(C, hash(D, E)))) = hash(E, hash(D, hash(C, hash(B, A)))) (for any permutation of A, B, C, D, E). I know these exist, but I'm unable to find anything on practical implementations.

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





I want to migrate TCP connections from one machine to another (transparently). I know I can use tun/tap to get at the raw packets, but then I have to implement my own TCP/IP stack which is kind of a downer. Is there a c library around (preferably MIT or BSD licensed) that will make this easier, or a documented api already available?

(Yes, proxy blah blah, I know. Not gonna work for this).

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





Troyo posted:

Where should I start? Perhaps I should learn the basics then determine whether I'd like to continue with the endeavor?

Read through something like http://www.djangobook.com/

If you can make sense of it, give it a shot.

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





Ledneh posted:

I'm not really sure how to go about it at all, since we've already conclusively proven that the algorithm in question is exactly the same in both programs. The only thing I could think of is to see if there's a way to figure out an "expected delta" between two processors' implementations of IEEE float 64 (and hell, 32), but again besides googling/asking about I'm not sure where to run with that.

While I'm researching what I can for myself, does anyone have any thoughts on how I might prove the hypothesis that floating point differences between the two processors is the cause of the differences?

One of the processors is probably using extended precision. Can you post the code, or the hardware specs?

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





Ledneh posted:

As I recall the Sun box is an UltraSPARC T2, but I have no idea about the SGI one at all.


the ultra uses 64 bit floats

try this on the sgi:

double x, y, z;
x = 3.0;
y = 7.0;
z = x/y;

if(z == x/y) ...

if it's using extended precison that comparison will return false, if it's using IEEE 754 64 bit floats it should return true. the sgi's processer should have an instruction to round all intermediate floats to 64 bit, but you're gonna have to find that yourself.

the talent deficit fucked around with this message at 15:12 on Aug 6, 2010

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





Triple Tech posted:

I sort of understand the motivation for a String Builder class, but do all languages have one? I'm thinking of PHP, Perl, Python, and Ruby. I know C# and Java do. If the others don't, why? Do they not suffer from the same implementation problem? Or do they not care?

Erlang has something called an iolist which is a (possibly deep) list of binaries (typically utf encoded string fragments), characters and iolists. All the io functions flatten and combine them efficiently when passed them as an argument. They're rather awesome.

An example:

["this is", ["a list", " ", "of the last five commenters encoded as binaries: ", [<<"Mustach">>, " ", <<"Alters">>, " ", <<"ToxicFrog">>, " ", <<"Lurchington">>, " ", <<"Triple Tech">>]], "."]

When sent over a port/io, it's converted to:

<<"this is a list of the last five commenters encoded as binaries: Mustach Alters ToxicFrog Lurchington Triple Tech.">>

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





I have a messaging system that consumes arbitrary binary sequences from a number of producers. Assuming all producers can read all other producers output, is there a way to uniquely identify producers that makes it impossible for producers to masquerade as other producers that doesn't rely on shared keys?

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





ShoulderDaemon posted:

If you want to uniquely identify a producer, you have to have some kind of information that is unique to that producer. What, specifically, can't you do that makes you think you can't use "shared keys"? If you can be more specific about what your problem is, then we can choose a MAC that will work for you.

I can use shared keys, but I'd like to avoid the overhead. I've got a bunch of processes (that I have no control over) writing to a single file (via a proxy that sequences the writes). I want to prevent processes from forging writes from other processes. They all have unrestricted read rights to the file, so I can't just use a unique ID per process. Right now, I use HMAC, but I'm trying to saturate the disk i/o, and the crypto overhead is preventing that.

Additionally, I'd like to avoid altering the message in any way, apart from enclosing it in some sort of container.

the talent deficit fucked around with this message at 02:12 on Dec 6, 2010

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





Yeah, I suspected as much. There's a few other ways to do it, but the all involve modifying the data written and adding padding. I think I'm going to have to stick with the HMAC.

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





What's the 'best' (friendliest API, most useful, best designed) web server abstraction layer? ie wsgi, rack, et cetera? any language, I need to port one of them to erlang.

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





ICK posted:

Are there any good resources for people who are new to software licensing/redistribution?

Licensing is only ever really simple or terrifyingly complex. Do you have specific questions? (Please don't ask, 'what license is best?')

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





If I want to release a library for non-commercial use only, what are my options? I thought the Sleepycat license was what I wanted, but upon reading, it turns out I'm wrong.

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





ShoulderDaemon posted:

Creative Commons Non-Commercial is probably your best bet, although it's not a software-specific license. Note that the open source community won't touch it, either, so you are likely to have very few users. A fairly significant portion of the open source community feels very strongly that software should not have licenses that restrict use in any way whatsoever.

I've seen a few libraries licensed under CC-NC, but nothing with enough of a profile that I was confident it's actually sensible for software.

We already have hundreds of commercial users of our SDK who pay for the right to use it. We want to release a free version (that isn't crippled) as cheap advertising. We're not really concerned with open source idealists, more just increased openness and exposure without hindering our ability to operate as a for profit business.

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





Gilg posted:

I've got a web API that returns JSON like so
code:
GET /stuff
[{"id": 1, "name": "blah", "cost": <something that requires a lot of joins>},..]
code:
GET /stuff/1
{"id": 1, "name": "blah", "cost": <something that requires a lot of joins>}

return instead:

code:
GET /stuff
[{"id": 1, "name": "blah", "cost": {"uri": "/stuff/1"}}, ...]

GET /stuff/1
{"id": 1, "name": "blah", "cost": <something...>}

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





The new tags are for better 'alternative' interfaces to consume html5. Things like screen readers, mobile browsers, Instapaper like clients, webapps that consume other webpages, etc.

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





I'd whitelist unicode display names, not blacklist. Allow common alphabets and maybe punctuation, special case RTL alphabets and make sure everything normalizes. Even if you do this people are going to be able to 'forge' other user's display names because of the common practice of reusing glyphs for nonequivalent characters.

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





stubblyhead posted:

I'm getting an http 405 error (method not allowed) using an application's REST inferface. I'm trying to POST, which the API guide says is allowed, and POST is included in the Allow header of the error page I get. As a developer, is the onus upon you to implement all the methods you want a resource to handle, or does that header get built automatically from the implemented methods? Basically I guess I'm asking if I'm doing something wrong (very possible) or if the devs didn't actually implement POST for this resource, despite all other indications (also very possible).

At a raw http level, you can shove whatever you want in the Allow header. I could claim my endpoint implements the 'PARTY' method. At a framework level you'd hope these would have some sort of constraint placed on them that verifies the Allow header in a 405 return isn't a filthy liar, but most frameworks are crap. In short, it's probably the API devs, not you.

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





I'm playing around with Vagrant and it's beginning to drive me crazy. Trying to use the chef_solo provisioner none of my `chef.add_recipe "foo"` declarations get added to the `run_list` in `dna.json` (in fact, there is no `run_list` key in `dna.json` at all). I feel like I'm missing something obvious.

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





pliable posted:

Are there any ML and/or functional programming guru's in the house? I'm having trouble conceptualizing/visualizing code from a functional paradigm standpoint, that and the syntax of ML is so crazy to me that it's blowing my mind.

do you have a specific question?

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





BlackMK4 posted:

Where does one start if they want to get into generating 2d/3d graphics and they are coming from a background of building console apps / SAAS stuff in Java/Python?

gaming? i'd try unity. or unreal engine. both are basically free (until you start making money with them)

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





This book is old but incredibly good and relevant to what you are asking: http://www.wayner.org/node/39

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





Cryolite posted:

How do people generally commit stuff to GitHub without including sensitive information like API keys that could be a big problem if they become public?

For some of my projects I've been stuffing sensitive keys/passwords into a "keys.json" file that I specify in my .gitignore, and then reading data out of that file when the application starts up.

Is there a better way of doing this, or some industry-preferred method? It seems pretty ad-hoc.

encrypt it: https://github.com/mozilla/sops

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





Bob Morales posted:

Are there some tutorials that explain how to do high-availabilty stuff? Not at the 'cloud' level but how you would manually implement it.

yes, but you're asking two different questions here

quote:

Imagine this, a file uploading service, with a web front end that runs on 2 servers in case one gets busy or goes down. You upload a file and then it gives you the URL you can then access the file from. I'm imagining a load balancer handling these front end servers.

this is easy

you stand up multiple stateless web front ends behind something like HAProxy or AWS ELB. where i work all our services run on either the jvm or the erlang vm and are trivial to jail so we don't use docker or any other containers. we just use AWS autoscale groups and AWS codedeploy for provisioning. some autoscale groups contain a single application, some contain more. each application gets it's own AWS ELB. this kind of stuff is usually called 'devops' these days

quote:

Now behind the scenes, whichever of the 2 servers gets the uploaded file, writes it out to say 3 file servers, and stores it in some redundant pattern. Perhaps splitting it up into chunks so that if one of the servers goes down you can read it from the other two.

All the while there's a database that tracks what files are where etc.

What is all that poo poo called and how do I learn more about it?

this is hard

first you have to learn about consistency and availability. most people have heard of the CAP theorem (you can only get two of consistency, availability and partition tolerance, and you have to pick partition tolerance) but almost no one can define consistency or availability as they are used in the CAP theorem. consistency as used in CAP means a very specific type of consistency where there is one and only one possible history of operations (writes and reads) that all participants (servers and clients) share. availability means that if a server has not failed (and usually that means failed as in stopped completely) any client must be able to get a reply to any request and the server isn't allowed to reply 'try later' or 'sorry not right now'. if you relax these constraints, you can cheat CAP

systems like cassandra, zookeeper, postgres, s3, et cetera all make different tradeoffs. cassandra provides consistent transactions with availability, zookeeper provides consistency with an option to forgo it when availability is important stale data is tolerable. postgres has a dial you can turn from from full availability to full consistency depending on needs at the moment. s3 is available with only vague promises of eventual consistency

once you learn about consistency and availability (this is a really good starting point) and you figure out what you need and what you can actually get implementation of solutions usually comes down to grabbing the best fit off the shelf, or, if you're ambitious, reading a bunch of research papers by peter bailis, leslie lamport, fb schneider, marc shapiro and eric brewer. chris meiklejohn has a fantastic list here

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





Cassandra is the only nosql product that really gets used in 'big data' and it's integration with hadoop/spark is not so great. Aurora and Redshift are way more common (both are SQL, sort of). What kind of tools are you looking for?

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





i used to be a thrift contributor and while it has it's uses i think that for 95% of use cases you are better off going with http and json (or xml, i guess) for any sort of internal network api. the tooling and infrastructure is just so much better than what thrift/protobufs can offer. http frameworks in all languages are light years ahead of the codegen that thrift/protobufs have built in and you get pretty major features like auth, caching and sessions almost for free. your client for development is curl or your browser instead of some generated header file you need to wire up to use

the schemas you get with thrift/protobufs are nice, but you can get the same thing from jsonschema or avro or something similar

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





spark runs fine with no cluster behind it. we have a bunch of spark jobs running on aws lambda and you only get like 1.5 gigs of memory there

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





foldl is almost always implemented recursively. (foldr sometimes gets weird)

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





Suspicious Dish posted:

OK, so instead of you downloading the schema file, the server sends its schema over at connection time and the client adapts. This was literally the point of SOAP, and one of the parts that they threw out basically as soon as they realized how useless it was.

imagine you had a sql client that could render tables with clicky bits. clicking a column would sort by that column or let you add or remove a filter condition on that column. foreign key references would be clicky too and would take you to the table they referenced with the row that contained the foreign key id highlighted or filtered out all other rows or something. also there's a back button to go back to the table you came from and a forward button to go forward again after going back. your client doesn't know anything about the schema of the db other than you're going to get some 'tables' with some 'columns' and 'rows' and 'foreign keys'. any table you can express in sql you can render. that's a restful hateoas interface

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





Suspicious Dish posted:

It's the "if we link resources together clients will magically figure out their relationships". Basically, you're stuck in the "wikidata is really cool" phase of growing up before coming to the realization of "wikidata is actually useless, generic structured data is really hard and the semantic web will never happen". There are still a lot of people working hard on solving this problem, and we're no more closer to a solution than we were in the 1970s. That's what I said was impossible.

what you claim is impossible is exactly how the web has always worked. that's the whole point of fielding's thesis. he wasn't dictating some architectural style; he was describing the most successful implementation of linked resources in the history of civilization

also rdf and sparql are a thing that works and is good. we're all just too busy banging rocks together to stop and learn how to leverage them to build a real ecosystem

Adbot
ADBOT LOVES YOU

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





Suspicious Dish posted:

edit: also pulling literally any data out of that page requires the schema of the db. From the other side: "your client doesn't know anything about the records in the JSON blob other than you're going to get some 'dictionaries' with some 'fields' and some 'values'. any table you can express in sql you can json blob. that's a modern restful json api interface"

yeah, what's your question?

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