I've found that Mongo has been awesome for app configs. The schema can change over time and it's a pain to hassle our DB folks to update the tables to meet our needs. It's much quicker to simply make the needed change on the app side and still have the ability to search on fields in the data.
There's stuff like RedbeanPHP that can do that for SQL.
Of course, you'll still want a proper DB guy to look it over once models are frozen.
I got a Microsoft screening interview on the second round, and I'm a bit afraid they're gonna ask all sorts of trick questions and gotchas as screening. Bowen, I'm gonna borrow your knife.
Then, if they trick me, I'll rear up ,drive the knife into the table, and whisper softly, "NullPointerException".
Make sure to research stack ranking and if you dislike it, and this would be a big deal, ask if it's still in practice.
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
On that note, I'm glad NoSQL is taking off. So glad.
I hate NoSQL.
Actually, I just hate programmers on the NoSQL bandwagon, because in nearly all cases, it means the programmer has no clue what the hell a database is, so they use NoSQL as a way to hide their ignorance. You can tell when you ask them to give you specifics about their problem, and find that it is one that can be quickly and easily solved in a regular SQL database.
I think you're being a bit too negative.
Now, when I say NoSQL below, I mean Mongo and everything I say has the caveat that Mongo has issues, it has search/indexing issues, it has some performance issues and it has relation handling issues. However, it has very real advantages, for the application and for us, the developers and it's foolish not to consider them for your next project:
Abstraction/Manipulation of internationalized data types is significantly easier.
Abstraction/Manipulation of multi valued data types is significantly easier.(even compared to Sql's supporting multi values like postgres).
Writing reducers in javascript is fun and readable, which makes it more accessible for programmers than plsql.
Development speed with NoSQL is fast.
Application modifications are fast.
Seeding data? lol json.
Exporting data? lol json.
Exposing data? lol json.
We switched a major project recently from postgres to Mongo, largely because of a huge fuck up I made in underestimating the performance impact a specific data model will have on our application. I've been super pleasantly surprised at how fast the development has been happening since the switch and how easily the developers started loving what Mongo offers.
There is a lot in NoSql land that I like and I'll advise people to take a closer look at what it can do for them as developers and for the application data model. Especially if the data model uses tables to contain complex data types;o(.
And to be honest, NoSQL doesn't have nearly the same length of use that SQL in general does. So it's bound to be less than optimal.
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
So is writing a responsive application in Python just impossible normally? It seems that way.
So far the only way I can think of to make a CLI app with some blocking IO in it still handle Unix signals properly is to declare a single master "notify" threading.Event() object, and have all my threads only ever wait on that, then check conditions when they're woken up coz something happened.
This seems really dumb, but the only way I can efficiently get a daemon process to sleep and not consume all the CPU without resorting to messing around with epoll and the like.
Which seems to conclude that basically I should just use gevent for things. But if that's the case, why not say screw it and just use NodeJS which seems much better suited to this type of logic?
fwiw, sigint will interrupt system calls if you don't have SA_RESTART set. Since it'll only get caught by one thread, you'll probably want to catch it in your main thread and then do some masking/sending to interrupt every thread.
I didn't think gevent's style is that similar to the way nodejs normally does things though? (Does nodejs have green threads? google keeps trying to give me pages about gevent when I check) Asyncore is probably closer.
End on
I wish that someway, somehow, that I could save every one of us
fwiw, sigint will interrupt system calls if you don't have SA_RESTART set. Since it'll only get caught by one thread, you'll probably want to catch it in your main thread and then do some masking/sending to interrupt every thread.
I didn't think gevent's style is that similar to the way nodejs normally does things though? (Does nodejs have green threads? google keeps trying to give me pages about gevent when I check) Asyncore is probably closer.
Well it's single-threaded, I'm not being precise with my definitions. Gevent honestly looks pretty interesting - writing sequential code and just saying "hey here's a good place to yield". It's the feature people are waiting for in NodeJS (yield/await keywords - coming in 11).
The problem with Python is most blocking Python calls also block signals. The final answer I've come up with is just to pass my objects "ingress" and "egress" queues which they block on, and define an "EventShutdown" class to tell the threads to die.
This way, the main thread can block on signal.pause(), which processes signals, I create a "manager" thread to control the workers, and they all talk to each other by blocking on Queues which are thread safe. Then the Queues just pass full Python objects amongst them, which gives a pretty versatile messaging system.
There are faster ways to do it, but the exercise is interesting in Python although the lesson seems to be that most internet examples are hiding a lot of necessary complexity.
EDIT: I guess for a clean sweep for my next trick I should re-implement the same thing in Haskell since I want to get into functional programming.
Shitty ass language (is it a language?) aside, this is what I have:
([A-Z]+\_+)+[A-Z]+\.([A-Z]+\_+)+[A-Z]+
Which selects the Databases/Views/etc... But now I want to reverse the selection. Basically I have a file (6300 lines) that has a lot of code. All I'm interested in are the Database/views/tables. So I'd like to trim everything but these views/databases.
Shitty ass language (is it a language?) aside, this is what I have:
([A-Z]+\_+)+[A-Z]+\.([A-Z]+\_+)+[A-Z]+
Which selects the Databases/Views/etc... But now I want to reverse the selection. Basically I have a file (6300 lines) that has a lot of code. All I'm interested in are the Database/views/tables. So I'd like to trim everything but these views/databases.
Is there an easy way to "not" something in regex?
Shitty ass language (is it a language?) aside, this is what I have:
([A-Z]+\_+)+[A-Z]+\.([A-Z]+\_+)+[A-Z]+
Which selects the Databases/Views/etc... But now I want to reverse the selection. Basically I have a file (6300 lines) that has a lot of code. All I'm interested in are the Database/views/tables. So I'd like to trim everything but these views/databases.
One thing that makes regex easier to stomach is to first do a pre-match pattern, where the first thing is to pare down your total body of text just to relevant stuff (usually this can be done with a more simple regex), and then you use the meaty regex on just the stuff that made it through the initial filter.
Ironically, using regex twice instead of just once tends to severely cut down the amount of weird rules and exceptions you normally have to put into the middle your regexes.
Is there an easy way to "not" something in regex?
Shitty ass language (is it a language?) aside, this is what I have:
([A-Z]+\_+)+[A-Z]+\.([A-Z]+\_+)+[A-Z]+
Which selects the Databases/Views/etc... But now I want to reverse the selection. Basically I have a file (6300 lines) that has a lot of code. All I'm interested in are the Database/views/tables. So I'd like to trim everything but these views/databases.
Negative look ahead (aka, "not ...") looks like:
(?!([A-Z]+\_+)+[A-Z]+\.([A-Z]+\_+)+[A-Z]+)
I tried that but the regex tester site didn't select any so I didn't put it in my code.
Wat. Using Teradata SQL Assistant... If a query fails then it stops running your entire file?
I have about 140 lines of SQL (simple SELECT *'s) to find out which tables exist and which don't... I'd like to run this entire thing without having to run it a hundreds times because each time a table is found that doesn't exist the thing exits.
it likes it fine, but "negating it" is only telling it to not match something, and nothing about what to actually match
I'm not actually sure what you'd tell it it should match though
Maybe .* or something? Basically want to grab everything around it and remove it.
yeah that was my first thought too but guess what
BUTT_BUTT.PANTS_PANTS is something you want to exclude, right?
well, _BUTT.PANTS_PANTS doesn't match your original regular expression, so it's ok to match against
normally under these circumstances, I'd still be looking for your butt butt pants pants and keeping the other strings, but I don't know under what context you're using it in, so that might not make any sense (especially in an editor search/replace)
End on
I wish that someway, somehow, that I could save every one of us
Posts
There's stuff like RedbeanPHP that can do that for SQL.
Of course, you'll still want a proper DB guy to look it over once models are frozen.
Make sure to research stack ranking and if you dislike it, and this would be a big deal, ask if it's still in practice.
And to be honest, NoSQL doesn't have nearly the same length of use that SQL in general does. So it's bound to be less than optimal.
Must be hard to get back to work after 9 days off, then 6 months of no work before that.
Everytime I take a week off I need a week off to recover from my week off.
Honestly if they paid me my salary to work 10 hours a week from home whenever I wanted to, I'd get so much more done than coming here 40 hours a week.
So far the only way I can think of to make a CLI app with some blocking IO in it still handle Unix signals properly is to declare a single master "notify" threading.Event() object, and have all my threads only ever wait on that, then check conditions when they're woken up coz something happened.
This seems really dumb, but the only way I can efficiently get a daemon process to sleep and not consume all the CPU without resorting to messing around with epoll and the like.
Which seems to conclude that basically I should just use gevent for things. But if that's the case, why not say screw it and just use NodeJS which seems much better suited to this type of logic?
I didn't think gevent's style is that similar to the way nodejs normally does things though? (Does nodejs have green threads? google keeps trying to give me pages about gevent when I check) Asyncore is probably closer.
Well it's single-threaded, I'm not being precise with my definitions. Gevent honestly looks pretty interesting - writing sequential code and just saying "hey here's a good place to yield". It's the feature people are waiting for in NodeJS (yield/await keywords - coming in 11).
The problem with Python is most blocking Python calls also block signals. The final answer I've come up with is just to pass my objects "ingress" and "egress" queues which they block on, and define an "EventShutdown" class to tell the threads to die.
This way, the main thread can block on signal.pause(), which processes signals, I create a "manager" thread to control the workers, and they all talk to each other by blocking on Queues which are thread safe. Then the Queues just pass full Python objects amongst them, which gives a pretty versatile messaging system.
There are faster ways to do it, but the exercise is interesting in Python although the lesson seems to be that most internet examples are hiding a lot of necessary complexity.
EDIT: I guess for a clean sweep for my next trick I should re-implement the same thing in Haskell since I want to get into functional programming.
Shitty ass language (is it a language?) aside, this is what I have:
Which selects the Databases/Views/etc... But now I want to reverse the selection. Basically I have a file (6300 lines) that has a lot of code. All I'm interested in are the Database/views/tables. So I'd like to trim everything but these views/databases.
You can use a negative lookahead
You are likely not in a use case where regex makes a good fit.
You fell into the paradigm of having two problems because you chose regex.
When you need to test an entire string for a match.
Social security? Is it 9 numbers with dashes? Regex!
Zip code? 5 digit string? Regex!
Places not to use regex:
Filenames
Pathnames
emails
bodies of text
getting strings from other strings
did you not see what gjaustion said
and the "good alternative" is to write some code to do the search yourself
Good alternative? Pft, way to understate that one.
"I'm sorry what you're looking for is a waste of time."
Ironically, using regex twice instead of just once tends to severely cut down the amount of weird rules and exceptions you normally have to put into the middle your regexes.
I tried that but the regex tester site didn't select any so I didn't put it in my code.
http://regexpal.com/
That site didn't like negative lookahead (or at least didn't select any of the data on the page when I tried it).
I'm not actually sure what you'd tell it it should match though
I have about 140 lines of SQL (simple SELECT *'s) to find out which tables exist and which don't... I'd like to run this entire thing without having to run it a hundreds times because each time a table is found that doesn't exist the thing exits.
If it doesn't find TABLE_3 then it just stops completely.
Maybe .* or something? Basically want to grab everything around it and remove it.
yeah that was my first thought too but guess what
BUTT_BUTT.PANTS_PANTS is something you want to exclude, right?
well, _BUTT.PANTS_PANTS doesn't match your original regular expression, so it's ok to match against
normally under these circumstances, I'd still be looking for your butt butt pants pants and keeping the other strings, but I don't know under what context you're using it in, so that might not make any sense (especially in an editor search/replace)