« first day (1946 days earlier)      last day (2999 days later) » 

12:00 PM
I'm listening ...
 
1. use a closure, which keeps the previous key "in memory"
2. read the symbols written in the textarea before user's current cursor position
 
@Shafizadeh Are you, perhchance, looking for an autocomplete with tab completions for mentions? jqueryscript.net/form/…
Something like this jqueryscript.net/demo/…
 
@tereško To be honest I don't know what is closure, but your second case seems possible to me
@Sherif Yes exactly
 
@Shafizadeh Then why not just use the jquery/bootstrap plugins?
Someone, at some point, went through a lot of trouble to solve this problem and decided to hand you the solution for reuse.
Might as well take advantage of it.
 
@Sherif I use jquery, but I don't use bootstrap, well, can I use that plugin?
 
12:03 PM
@Shafizadeh then use the plugin. You would need to learn a lot more JS before you could write that type of stuff from scratch
 
@Shafizadeh Sure, the bootstrap stuff just makes it look prettier, but the jquery plugin exists on its own.
 
@tereško Ok
@Sherif verywell, thank you
 
And honestly, why wouldn't you use bootstrap? You don't strike me as someone that could due without a little help from such awesome tools.
 
@Sherif .. it's more a case of "making it look same as the rest of done-quick sites"
 
@Sherif just another advise, I have used @media{} to make my website responsive (I mean usable in any-device-screen-size).. And I didn't use bootstrap. Now I want to know everything is fine?
 
12:06 PM
@Shafizadeh Play to your strengths.... Is my general advice.
 
@Sherif Bootstrap isn't awesome to me .. the internet speed is really slow in Iran and bootstrap is kinda heavy for my website users
@Sherif :-) thank you
 
@Shafizadeh Well, it's not like there aren't solutions for that kind of thing. The question you have to ask yourself is: do the pros outweigh the cons? I think you'll find that in most cases, reducing the cost of development is a significantly large benefit that's hard to dismiss in contrast of petty technical problems that have good solutions.
 
@Sherif Look, in that plugin you linked, that autocomplete is depend on what? is there any JS-array ? How can I write my data (words) in that array? (how can I fill that array with my website informations)
@Sherif ya ..! agreed
 
@Shafizadeh Well the article I linked you to kind of goes over that stuff. I don't feel terribly inclined to regurgitate the information in here. Maybe give it a read on your own?
 
ok I will read it ..
 
12:12 PM
@Sherif it doesn't look like you can pull the list from XHR there
 
@tereško I don't know. I didn't look at it too closely, but my guess you probably don't want to anyway. I doubt that in a typical use case your search criteria is that large that you can't just populate it on page load.
I'm sure there's some prototype there that you could override to trigger an xhr though.
Perhaps try a callback in the data?
I didn't try to be honest.
 
didn't look like that's an option .. besides, it's a jquery plugin .. you either use it EXACTLY as it was intended, or you dont even bother
 
@tereško May you please explain this comment other shape?
 
@Shafizadeh "it looks like you can't use AJAX to get the list of suggestions"
 
@tereško ah :-) Well I don't want AJAX ..! JS-array is what I want :-) (tnx for clarification)
 
12:19 PM
mind you, "AJAX" is actually wrong term these days, because it stands for "asynchronous javascript and xml" ... and nobody is using XML for data anymore
 
I see
"mind you" means "keep in your mind" ?
 
ah, got it
 
Looks like selectize has a callback option for loading the list github.com/selectize/selectize.js
 
So maybe "but mind you" would be better ;-)
 
12:21 PM
Not like there are a shortage of jquery plugins out there anyway...
I mean, ffs, 1 in 8 questions on SO are tagged javascript and the majority of code committed to github is js, so...
 
quantity has no correlation with quality
:P
 
Sure, but I was pointing out that the probability of finding what you want is more likely rather than making any statement of quality.
At the very least you'd have a starting point.
 
Ok well, I have another question, I have a string like this:
var str = "Hello @Jack";
Now I need to send a notification to Jack. I can extract that name from string using regex. But how can I find that guy in the database? (because maybe multiple Jack be exist the database (duplicate name))
 
Surely you don't have duplicate usernames.
 
I have ...! username isn't unique
Email is unique
 
12:29 PM
Then you have bigger issues.
 
shit :(
 
Why would you allow two users to have the same username?
Seems silly.
 
that ^ :-)
 
@tereško Usernames are not used to uniquely identify users on SO though.
They're more like screen names.
 
12:31 PM
those names are what you use them to ping people by @
 
@Shafizadeh Sure, but the underlying mechanism is still the user id.
Notice your user id is still in your profile link regardless of your username.
 
yes
 
Without that you have no way of knowing which user is intended.
 
Well .. it's kinda simple: you only give ability to ping people who already are part of given "conversation"
 
Which still means nothing if two people with the same username happen to be a part of the same conversation.
You still need a unique identifier.
 
12:33 PM
@tereško Yes, it is exactly what I want to do, but how can I find that guy in the database?
 
If username is not it then user id.
 
I think the only option is using user_id to identify exact person..
 
@Shafizadeh the "Hi @foobar" should be actually transformed into "Hi @{51964}"
 
@tereško in the textarea? or when I want to send it to server I should translate it?
 
when you select an autocompleted username you also add anew entry in a hidden form field
 
12:35 PM
oh ... hidden input could be a good solution
 
something like {"@foobar": 51964}, which you can use to "decode" the comment/post
 
ah - I think I got a clue :-)
 
or you can have a field with all the username-id pairs listed all the time
or pull that list from DB, before saving new comment/post
... there are multiple approaches you can pick from
 
Those approaches are theory .. I don't think implementing all of them be possible
Because still I'm faced with this problem ;-)
 
Was it your intention to make the problem more complex than it needs to be?
 
12:39 PM
:-)
No, I have the algorithm in my head .. But implementing it is somehow vague for me
 
@Sherif it's that or "ping everyone"
 
hi!!!!!!
 
@Shafizadeh I'm just curious, if you wanted to make mentions using usernames, why didn't just make usernames unique? I'm not saying it's impossible to do it without unique usernames, but it certainly simplifies your design.
 
@Sherif you also end up with usernames like _*_John_*_111
 
@Sherif Because username is filled by "lasname", and there is a lot of identical last names
@tereško yes, this is also another problem which will be happen
 
12:42 PM
@Shafizadeh But why would you do that? Like what led up to you making such a decision in the first place?
What popped into your head that made you think "I know what a username will be: It will automatically become the person's last name!!!!"
Explain the rationale behind that.
 
ok, username have to be what? you tell me? cell-phone number?
 
different people make usernames based on different things: real names, childhood nicknames, some random word salad
 
@Shafizadeh The problem with telling you what to think is that it does not lend itself to helping learn how to think. Notice my question is meant to understand you, not impose something on you.
 
I think a short name as username makes a user-friendly UI
@Sherif ah :-)
 
Telling people what to think leads to a mass of ubiquitous monotony and a lack of innovation.
I find that people who have always been taught what to think have a deep-rooted fear of exploring their thought process. Embrace your thought process by feeding it new information. Otherwise it has no fuel and its fire burns low.
 
12:49 PM
Your English is really hard ... google-translator blocked me ..! Because I sent more 1500 requests to it in less than 2 hours
 
@Shafizadeh Don't be afraid to change your mind about how you do something
Is that simple enough for you?
 
Yes it is ;-) But actually I'm trying to implement what SO done.
 
LOL :P
 
there are 7200 seconds in two hours
that's about 1 request per ever 5 seconds ..
 
:-)
 
12:51 PM
@Shafizadeh Why?
 
LOL heheheheheehheheehhehehe I cant stop laughing... :P
 
@Sherif Because the concept of my website is like SO, and SO is the best website in this field
 
Really??
 
yes, really !
 
@Shafizadeh Best is a relative term. One man's trash can be another man's treasure. You failed to address my question.
 
12:54 PM
@Sherif I like it when you don't use dead-simple English … if everyone around me just uses simple English, I won't be able to learn much :-)
 
WHY is having non-unique usernames the best thing for you in this case?
 
@Sherif usually because users may like it
 
@Sherif Because showing this message to users is annoying: "this username is already used, choose another one for yourself"
 
@bwoebi Thanks ... I think
 
Maybe it's his wish or something to build it...
 
12:55 PM
@Sherif example SO … a lot of people use their real name here … which is probably not unique.
 
that's why I have 3 different usernames .. and one of those "azazul" was intentionally chosen because of ability to freely choose combination of vowels
 
@Shafizadeh OK, so that's a design choice. You want a better user experience. Now you need to think about the consequences of this design choice.
 
ya .. and thanks again for that jquery-library @Sherif ...!
 
@Sherif well, that wasn't a compliment nor a reproach … Just saying that your writing stile is fine as is :-)
 
yo @PeeHaa!!
 
12:57 PM
Morning
Feb 8 at 12:30, by Gourab Nag
@PeeHaa Where are you from??
 
@bwoebi dunno ... his vocabulary seems about as simple as any other here ... well .. except for stereotypical "indians"
 
@bwoebi as is?
 
oh okay sorry!
 
There are no people on the internet - we are all just chat bots.
 
12:59 PM
> chat is just multiplayer notepad
 
@tereško A slight bit more complicated
 
@bwoebi I guess you were referring to my dumbing it down when he said he trouble understanding me?
I lost context there.
 
@Sherif yea
 
(just to note, that was actually in response to something earlier that I missed the opportunity to reply to)
 
@tereško except, that you can't edit what was 5 hours ago…
 
1:02 PM
stop ... poking .. holes
 
What's the fun in that?
 
@tereško hm?
 
@bwoebi He's suggesting that you should not split hairs to make his thesis less defensible.
 
@Sherif I guessed that, but wasn't sure …
 
Flying from cold climates to warm climates is depressing when you know you have to fly back to the cold shortly :/
 
1:08 PM
user image
5
 
man i saw that a few hour ago on 9gag @PeeHaa!
 
@PeeHaa heh
 
@PeeHaa Why did my brain read molotow cocktail the first time on the last line? :x
 
you probably should see a specialist about that
 
:P
 
1:14 PM
yeah, I've just never heard the word "mocktail" and the closest was molotow cocktail…^^
 
@bwoebi Is that how the British spell Molotov?
 
nah, just from reading the word, not from the sound…
 
^ yea exactly
 
I developed the ability to read that about two days after first getting on IRC.
Doesn't make me want to strangle those people any less, though.
 
1:40 PM
@tereško still means you need all the letters in the word
 
not really
 
that's the case in your image, at least
 
Wes
2 hours ago, by Wes
@PeeHaa found a typo github.com/CodeCollab/…
in case you missed it
 
@FlorianMargaine That's the whole point of the image: that you don't actually read and process each letter individually.
 
@jbafford yes, but note that all the letters of the word are still present
 
1:42 PM
@Wes oh that's why it didn't open on mobile :)
 
Wes
youtube doesn't work on mobile? .D
 
@FlorianMargaine especially on larger words your brain also sometimes adds some letters…
 
@FlorianMargaine all the letters may be present, but that doesn't mean that they're all required.
 
@jbafford my point is that usually, people showing this image are in favor of sms text, which point is to avoid as many letters as possible
 
ok, that's a fair point. I don't think this image forms an argument either way abt wrtn lk ths. txt spks xcdngl lm, th.
 
1:50 PM
@jbafford xcdgnl?
 
exceedingly
 
hi
This is not a php question but it's related to mysql so i think i can ask here, sometimes in a transaction foreign key fails with error "Cannot add or update a child row: a foreign key constraint fails". There are 2 tables PARENT and CHILD, child table has a foreign key to parent table. First i insert to PARENT table and then to CHILD table, but sometimes(very rare) inserting child table fails.
It can't find PARENT row but they are both in same transaction and parent is inserted before child. Is this a known mysql issue?
if i try it again, it works. as i said this happens very rarely, about 1/100k transactions
 
@draconis What library are you using to connect to the DB?
(It sound more likely to be a bug in the connection code rather than anything else)
 
as i said i'm not using php, i just want to learn is this a known mysql issue? not to waste my time to fix if this is a known issue?
 
2:06 PM
Ok, even if you're not using PHP, what are you using to connect to the DB? Or are you typing in a lot of 0's and 1's ?
And no, it doesn't sound like a MySQL thing - it sounds like a 'connecting to mysql' thing.
 
using sequelize
 
in what way does that look like a "connecting to mysql" thing? It looks like a transaction problem once there's already a connection.
 
@jbafford It could be the library is using pooled connections, and doing the operations on different connections. That's the only way the issue could arise.
(assuming the code isn't just bogus).
 
something would have to be pretty bogus for sequential queries in a transaction to happen on different connections.
 
You mean like that?
 
2:10 PM
yow
 
@draconis the library you are using has a very alarming number of open issues - including over 50 on transactions
 
yep
but it's only decent orm atm for nodejs :/
 
23 hours ago, by Danack
.....I told this joke when giving my talk.......There's tourist driving around rural Ireland countryside, and he's lost.
23 hours ago, by Danack
He sees a farmer standing at the side of the road, so he stops and asks the farmer "Excuse me, can you tell me how to get to Dublin".
23 hours ago, by Danack
And the farmer replies "Ah, to get there, you certainly don't want to start from here."
@draconis It's not going to be a problem with MySQL - it's going to be a bug in the library.....you should probably report it, but we're not going to be able to help you more, except if you want to learn how to re-write your application in a stable language/environment like PHP.
 
@Danack to be fair, I've seen less segfaults in nodejs than in php.
 
And the segfaults in NodeJS are so much faster as well!
 
2:14 PM
tbh nodejs sux
i miss python
 
@Danack /dev/null is webscale!
 
@FlorianMargaine yeah....I think PHP could really do with fixing some recurring stability problems....rather than new features.
 
but for this project nodejs is a mus :S
must*
 
I've written exactly one app with node.js. If I had to do it again, I wouldn't use nodew.
 
thanks for help anyways.
 
2:15 PM
@draconis tbh - transactions can fail for multiple reasons anyway, and so it is not unreasonable to retry them a couple of times before failing permanently.
 
well, not a full app, just a component to one
 
TIL there is only one good PHP templating library: Latte. It's the only library with context-aware escaping. And it pretty-prints your HTML! It's amazing.
 
which would probably cover your problem enough, maybe.
 
nah, this seems a temp solution for me, i think i will keep searching a bit if it's really about orm
i will quit using this orm
 
even for 1/100k case?
I'd just retry and move on
 
2:17 PM
yep
this is a bank application
1/100k is important actually
 
................................k
 
Well, I hate to say you're fucked, but .... you're fucked.
 
You might really want to spend an hour thinking about:
3 mins ago, by Danack
@draconis tbh - transactions can fail for multiple reasons anyway, and so it is not unreasonable to retry them a couple of times before failing permanently.
for example if the network drops for a moment.....not having your application fall over might be a worthwhile thing to do.
 
i will do some test
 
"Me connection fail? That's unpossible!" </ralph>
 
2:20 PM
No it's TCP - TCP GUARANTEES the packets are delivered!
 
to be sure it's really about orm or other reasons before changing code :)
 
@Andrea where are its limits?
 
@bwoebi it doesn't actually deliver the latte.
2
 
@FlorianMargaine ?? … was that a pun about the coffee?
 
2:22 PM
but really, stay away from node like 1-2 years more
 
All code fails. If losing the transaction is a problem, you need to make a reliable solution by building a reliable system, not by eliminating all known bug.
 
Jan 14 '15 at 13:18, by Paul Crovella
the best thing about node is it got everyone to stfu about rails
 
0
 
@bwoebi yes
 
@FlorianMargaine hehe, took me a moment ^^
 
2:23 PM
anyways, thanks again.
i've got my answer, if it's not about mysql, i will keep searching to find out whats happening
Ciao
 
@Danack I like how you phrased that, very well said
 
@FlorianMargaine ta - this gives me nightmares about that stuff.
 
@Danack ow.
I'm glad I'm not working on life-critical stuff.
 
@tereško are you on? You said to ping you up.
 
And that's not even a distributed system, where errors can occur invisibly between components.
 
2:28 PM
@Dante so, are you still having issues with configuring the webserver?
 
@tereško well no issues per say, since I can configure it manually to point to the public folder location, whether it's a domain, subdomain or whatever. My question was if that could be done dynamically.
 
as in www.site.com goes to /var/www/main/public and cms.site.com goes to /var/www/admin ?
 
Sure. It could be applied that way too.
 
@Dante dynamically, depending on what?
the Host? the size of the request? the path of the request? the time of the day?
 
2:33 PM
meh
 
of course it would require you to have access to your webserver's config (I am assuming you use apache)
 
if he wants dynamism, he has to write his own reverse proxy
 
Florian, dynamically, as in through a local file located in the project folder that requires no further manual configuration, for portability.
 
no, you cannot do that using .htaccess
 
2:34 PM
So you're confirming it is not possible to have it work without manual configuration.
 
depends on your definition of "manual"
it is impossible to do without access to root and changing server's config
the point of setting a specific document_root is security .. if any user could just change DOCROOT by editing .htaccess, it would be a nightmare
 
That second part is what I meant, and what I needed to know.
 
@Dante I have a library for that stuff - it allows you to store all of the possible settings in source control, and then generate config files as appropriate for the environment: github.com/danack/Configurator
 
@Danack that looks made for nginx and not apache
 
It's a config file generator - you can generate config for whatever you want.
So put Apache config template in, get Apache config file out.
 
2:38 PM
@tereško I kind of figured that after I did more research on it, I just needed someone to confirm. If you write that as an answer to my still open topic I'll be able to mark it as solved.
 
that's too much effort
 
Haha.
 
the point of setting document root is this: when (and not "if") shit happens and your code in document root becomes readable, it could not contain any sensitive information
 
I know how to do that too, I was just wondering if that could be configured to work in every instance without further configuration. Guess it was a silly question in the first place.
 
2:40 PM
you can configure the apache so that it automatically recognizes /var/www/<site-name>/public as document root for site-name.com
 
Btw just for further confirmation. When you install and configure a framework, for instance Laravel, do you have to manually set the root to the public folder?
I'm guessing yes.
 
@tereško right.
 
@Dante no. Usually not. Frameworks usually are not tightly bound to a specific directory structure
you might need to configure the relative location of "framework" ... but these days with composer that's almost never becomes an issue
 
@tereško I see. Thanks a lot for the help. I really encourage you to write an answer to that topic with what you just said so I can close it, if you want to.
 
2:45 PM
@Dante I can't speak for Laravel, but Symfony automatically determines its "root directory", and if you need that for some reason, you can get that value out of the container.
 
if you index.php contains include __DIR__ . '../../somewhere/deep/bootstrap.php';, then all the supoerglobas ($_GET and $_COOKIE) are still available in the bootstrap file
 
oh. that's not what the question was actually about.
 
I know but I'm not talking about the local root. I'm talking about the relative root. The access users have remotely to the server. Say something fails, they'd only have access to that public folder.
 
for the "entry point" of your site there is no real difference where it is located
 
yeah, everything @Danack said.
 
2:47 PM
moin
 
Ideally, you want as little as possible actually directly web-accessible, and modern frameworks encourage that design.
 
what is "relative root"?
 
@jbafford ... Danack hasn't said a word since 10 minutes
 
...
 
www.site.com/something .. if something is a folder it would be located in the public folder.
 
2:49 PM
I meant @tereško
 
I'm using that term to call the location accessible remotely by users.
 
that's typically called the "document root"
 
"remotely by users"?
you mean via SSH or FTP?
 
no, he means the HTTP path
.. I think
 
are you willing to bet on it with your own money?
 
2:51 PM
no, but I'm willing to bet on it with your money
 
I'll take that bet also with his money.
 
Say you have your application with your public folder in it. If you configure the domain or subdomain to make the request to that public folder instead of where the entire application is stored, the users will always only be able to access that public folder. Via http, ftp, etc.
I wondered if it was possible to somehow make the server do that through a configuration in your application. But from what I read and you told me, you need to configure the server.
Case closed. :P
 
the developers should have access to /var/www/site-name if document root is set to /var/www/sitename/public
that's what they should be able to see via ftp or ssh
users via http should only see content in /var/www/sitename/public
 
Yes but the ftp request is password protected so it doesn't pose an issue, I don't think.
 
yay i got my domain working!! gourab.me !!
 
2:58 PM
Sorry if I'm not explaining myself very well, I'm not used to working with many other programmers.
Or, talking to, in this case.
I meant public requests, usually by http.
 

« first day (1946 days earlier)      last day (2999 days later) »