« first day (1328 days earlier)      last day (1330 days later) » 

12:04 AM
is a tool/language for relational models
 
What are quotation marks ('') and how are they affecting the query?
SELECT * FROM 'test' vs SELECT * FROM test?
 
 
1 hour later…
m59
1:15 AM
@TehShrike I'm freakin' out man.
If your code doesn't contain the word "DELETE", how in the world can a record be disappearing??
 
m59
1:28 AM
this is friggin crazy.
 
m59
1:42 AM
If I try to login with Safari IOS, my account is deleted. Great.
 
m59
2:01 AM
It has to be transactions...
err, but..
 
m59
2:15 AM
Well, I'm starting to find it.
 
@m59 wassat?
@m59 are you inserting a record, reading it back in the same transaction, but then never committing?
 
m59
The only place I have a DELETE is when merging users.
if (!req.user)
this is the issue
but I'm not sure how to solve it.
 
@m59 you've verified that the merge is getting run?
 
m59
It definitely is
 
what's the pseudocode/business logic?
 
m59
2:22 AM
I think I need if (otherProfile !== req.user)
According to a tutorial I followed, passport should only be running the authentication if you aren't already logged in.
 
using the MS login system?
 
m59
MS?
 
Their old single-signon service was called passport
 
m59
PassportJS node module
See "new facebook strategy" ^
the if/else there
I've gotta wrap my head around what all is happening. It's even stranger that this never happens on desktop.
yep
so, it's saying "the user is already logged in, AND the user already has a google ID of this", then tried to merge the account with itself and then deletes itself
I need to repent of this code.
In that day, Jesus will say unto me, "depart from me, you worker of javascript iniquity."
 
There's always 104.131.240.195
 
m59
2:39 AM
Oooo, nice.
I still need Google/Facebook/Twitter
but I don't really want local login.
I mean, I need it, but I don't want it
maybe that would be a nice alternative?
 
A friend and I have been working on that module. I think it's pretty reasonable
I'm done with passwords
I'm never implementing them on a personal site again
I think it's feature complete, Joe's just been working on the demo site, and the documentation needs some work
 
m59
Ah man, I'm wrong
It isn't running the merge
it's running the update
How can an update erase a record!?
 
@m59 by changing the primary key
or, I suppose, by a wacky trigger
 
m59
"UPDATE user SET google_id = ? WHERE id = ?";
 
2:56 AM
I assume by now you have console.logs in front of every insert/update/delete involving the user table?
or have breakpoints on them via node-inspector
 
m59
yeah, logs everywhere
It's not running a DELETE
lol now it is.
So, I guess it was a problem with the logs
OpenShift seems to have conveniently timed out any time the merge was running
I reset the connection each time and now I see it
Safari IOS must be sending some ridiculous request I'm not telling it to
It's like it tries to login twice
I set some ugly if's to check the conditions and ensure this can't happen
 
3:23 AM
 
 
3 hours later…
m59
6:47 AM
Have you ever heard of sort of modularizing mysql interactions?
I'm imagining a comment module, for example, where I could just pass it some information like a table name, related table and related records and it would build the table and have functions ready to be assigned to routes that would handle the interaction
app.get('posts/:id/comments', function(req, res) {
  comments.findByRelated('post', req.params.id, function(results) {
    res.json(results);
  });
});
something like that
 
 
10 hours later…
5:04 PM
@m59 like a sort of ORM Lite?
I haven't done it myself, but I have found opportunities where it made sense to compose queries iteratively
For example, have one function that returns a query-builder object the equivalent of SELECT [all comment columns] FROM comment
Where that function is only used internally and isn't exposed, obviously
But another function that might be exposed would take that query object and add on a WHERE comment.user_id = ?
Another function that might be exposed would mixin WHERE comment.post_id = ?
 
 
1 hour later…
m59
6:21 PM
Hmm, I guess that would be ORM-ish
I'm just thinking abstraction, but it wouldn't at all interfere with whatever else you might want to do.
 
@m59 if you're using that cool query-builder, I think you should be able to compose your queries pretty reasonably
 
m59
Well, it's not for the sake of actually composing the queries, it's more like for hiding ALL the logic.
 
well, your database access should be in its own layer, if that's what you mean
 
m59
I sure hear that often and have no idea what that is ;D
 
a module exposing database access with a bunch of individual functions like require('commentsDao').findByPostId(postId, function(err, results) { ... })
but inside of that module you shouldn't seek to hide the SQL
 
m59
6:27 PM
Yeah ^ that is what I want
Optimum abstraction
errr
dang terms
 
I do the same thing on the client-side with Angular
To wrap up HTTP calls
 
m59
that's still unclear - by module do you mean a real module or module.exports = stuff
 
depends on how you break up your server-side app
is it all one "module" with many files in it, or do you actually break it up into different modules with different package.jsons?
 
m59
To me, something isn't really a module unless it's senseful to publish it on npm and make it a dependency of your app
"module" in my mind, means that it isn't tied to your system; reusable; solves a problem in general
 
that's fair
what do you call a file that you include with require()?
 
m59
6:30 PM
A file haha
 
it operates inside its own function scope when required
 
m59
service, I guess.
 
whatever makes sense for how you're breaking up your app
 
m59
I doubt my thinking is good, I just try to make sense of things the best I can.
 
If you have portions in different modules, general database access will make sense in its own module
This is a similar idea on the client-side
 
m59
6:32 PM
Hmm, I've been making one service like user with methods for things user can do
 
Replace the $http calls and url strings with your query library and SQL strings
 
m59
or like postService.create(post)
 
yeah, that's what I'd do with node requires
return { create: create, delete: delete }
With the Angular dependency injection it seemed to work all right to have functions on their own, but my opinions there aren't terribly strong
 
m59
What I want to do is kind of like Disqus
except local as an nom module
 
I don't know what their API looks like
Or did you mean just functionality?
 
m59
6:38 PM
npm install comments

// creates this table if not exists with post_id as a FK to the post table
// maybe a getter function for a database connection?
comments.init({
  related: {
    post: 'post_id',
});
and then you can just require('comments') wherever and use it like I showed before.
I think that would be usable in any project where you need comments
 
aren't there a good number of competitors in that space already?
 
m59
drop in node modules for comments?
 
yeah
 
m59
I haven't seen any.
 
mostly client-side though
Otherwise, it would just be a table and a dao, right?
 
m59
6:40 PM
What I'm talking about wouldn't have any client side
Yeah, I think so.
 
I suppose it would be a table with columns for namespace, comment subject id, commenting user id, timestamp, and the comment text
 
m59
yeah. What I have works fine. What irks me is that I couldn't easily drop it into another project.
I hate writing code that I can't drop into some other project.
I'm fairly obsessive.
 
you could though, right?
that project would just need to have the same table
otherwise, you'd need to expose http access to this module and give it its own server
and at that point, you need to add authentication so that only your services could use it
 
m59
I do really like that concept - SOA, right?
but the auth thing sounds like a nightmare.
Actually, that's not true anymore
you still need a comment module, then you require it into a comment server
(effectively Disqus)
 
related: this crazy person dreamsongs.com/MobSoftware.html
and the Steve Yegge rant steverant.pen.io
 
m59
6:59 PM
you're affirming what almost makes me doubt if I should be a programmer.
But God brought me to this point and I'm at peace right now, so forward I go.
 
@m59 lol
I didn't mean to cause a bout of imposter syndrome
 
m59
hahaha
It's these 2 problems
1: I have been striving toward the day when I "got it" and could write that perfect software I thought everyone else was writing, and now I know there's no such thing
2: Nothing is reusable
 
hmm, you're not on the geek chat
 
m59
forgot to open pidgin
 

« first day (1328 days earlier)      last day (1330 days later) »