Comment on: NoSQL is a "complete game changer," declares database expert
0 31 Jul 2015 21:43 u/Monqui in v/programmingComment on: NoSQL is a "complete game changer," declares database expert
That toy project was specifically MongoDB and I was writing the application in Ruby. Profressionally I mostly do mssql/mysql, so in general I'm a big fan of RDBMs.
There is a mechanism for doing what you're saying, kinda. They call them "indexes." I put it in quotes because it's not quite the same as a RDBMS index, but solve similar problems. If I'm remembering right, when you set up an index on a collection you specify whatever properties you want to filter/match for- so something similar to a "email LIKE '%abd%' AND is_active exists AND is_active == true", in your example. Granted that sounds like a terrible and really, really special index, but doing a similar one on just the "is_active==true" users would make sense. Or even one that collects active users with ones who have a non-empty email address prop. From there, when you query and ask for an existing email address and an is_active, it'd at least cut down the number of docs you'd have to scan to match the LIKE '%abd%' bit.
Once you set the index up, it initializes it with any current matching docs, and on edits/adds/deletes, it'll keep it in sync.
It definitely is just a weird little way of thinking about stuff. I'm still at a bit of a loss as to Real World, Actual Use Cases for nosql, but hey, it makes a neat toy :D
Comment on: NoSQL is a "complete game changer," declares database expert
It's main strength for me is just the fact that there is no schema to constrain you. You just have collections of json objects (callled "Documents"), and tools for finding documents that meet certain critera.
Kind of a convoluted example, but lets say you just made a hot new website and got all sorts of users to come and log in, create accounts, all that fun stuff, and then months later you find want to add in a feature that lets you send text messages to your users phones. But you didn't collect phone numbers originally.
All you need to do to support this is change you save user function to start sending in a phone number. Then, when you want to communicate, you can write a find() that only grabs users that have that phone number property set.
That's basically it. No adding new columns/tables, just slapping on new properties to your existing $things.
As @Master_Foo mentioned, it's great for prototyping out a new system where you aren't quite sure exactly what your end requirements are going to be. I have a little toy built up that does more of the data crunching he mentioned- and it's just painfully slow. It was pretty easy to set up and get the idea into code, but it's not scaling super well.
Comment on: Does anyone have any experience in Laravel PHP?
REST API calls are basically just HTTP requests- Guzzle is (I think?) a more PHP friendly OO style way of doing HTTP requests, which is what cURL would do for you as well.
Inside of Laravel, you should be able to just roll a basic cURL request to your API.
Comment on: Feature Request: FAQ bar
I kind of like the idea of having a whole subverse devoted to programming FAQs. Would give people a place to go and see comments from other people probably in the same boat/learning the same topic. That way they can be a bit more dynamic, and wouldn't have to constantly update those FAQs manually per se.
Probably more of a chance of overlap, but if it's managed well I think it could be a pretty powerful tool.
Comment on: Subverse CSS Question
I came across a link yesterday with a guide specifically for getting started on voat stylings, but can't seem to find it now...
/v/css and looks to have folk talking about similar. Might be a good resource.
Comment on: Enum Flags are hurting my brain.
I might be misreading something here, but shouldn't your integer values be 2^n?
Normally bitfields have a bunch of yes/no flags- you can tell what flags are set to true by checking to see if the bit assigned to your property is set to 1.
What I see here are some options that could cause collisions. If you see "10" coming out, how would you know if that was a combo of A+D, or if it was just E.
I'd try changing it to this-
public enum attributes
{
A = 1, // 0b0000000001
B = 2, // 0b0000000010
C = 4, // 0b0000000100
D = 8, // 0b0000001000
E = 16, // 0b0000010000
F = 32, // 0b0000100000
G= 64, // 0b0001000000
H = 128, // 0b0010000000
I = 256, // 0b0100000000
J = 512 // 0b1000000000
}
Now, you can use what /v/trayfly mentioned, and rig up a system that will take the value from that enum, do a bitwise and with JUST that value against your object with permissions- so if that bit is set in both, the flag is set.
edit added some clarity to the bit part in the code.
Comment on: Why this sub sucked on Reddit and how to make it not suck here
I like the ideas of FAQs. Maybe even set up a /v/programmingfaqs or some such- someone asks a question enough, folks should be able to aggregate together a nice set of resources for the thing, roll a new thread, start pointing people there. Also, gives people a place to talk about it among other people who were in the same boat and looking for answers.
Comment on: Good tutorial on how to add Facebook Login to your app?
It's been a while since I looked too deep, but I thought Facebook had an Oauth2 implementation you could use for logins like this...
Dug this article up that looks to show how to connect ASP.NET MVC4 to an OAuth2-ey service.
Comment on: 0x5F3759DF, The inverse square root hack.
Reading this made me think of how I felt when I first read up on Booth's Algorithm for doing bitwise multiplication. I just can't wrap my head around how you'd begin to come up with stuff like this.
Hey, I said it was a convoluted example :D
I'm with you though for the most part. I still think there's some value just behind the idea of nosql I guess- worth taking the time to learn about, but I see it more as a different way of storing info vs a complete replacement for RDBMS. And the people that want to use it as the silver bullet to solve all of their previous DB woes are kinda missing the point I think.