« first day (1853 days earlier)      last day (3098 days later) » 

12:00 AM
@SterlingArcher loved this
 
in using angularjs ui-view, is there any other element i can wrap it in other than div?
ok, just got it.. i'm using <ui-view></ui-view> better
 
thanks all for your help. I think I'm benching this for the day
 
is it ever a good idea to incorporate unit tests into the actual execution of a program? i'm writing a data import tool for a few data sets we need, and I want to be absolutely sure the data is getting imported correctly, so I only want step 2 performed if we can be certain step 1 ran correctly
i know this will introduce performance concerns
or can this be taken care of with good exceptions?
 
12:16 AM
@NathanJones generally, no. But writing testable code usually means you're writing properly modularized code, so they go hand in hand
in that case, you're not really doing unit tests, you're doing validation and that is 100% a good idea to do if data quality is important
 
testing that data was imported correctly sounds like a legitimate need.
 
naw
 
if you're using a transactional database, this would be an appropriate place to use a transaction
 
this is in oracle
@Codeman can you elaborate on what you mean by "transaction"?
maybe what i'm talking about is integration testing?
 
not sure how it works in Oracle, but in SQL Server, you can create a transaction and either roll back or commit that transaction. It's a language-level construct.
so you can do a bunch of UPDATEs, INSERTs, etc. and then say "is this data right?" if it is, you commit it and the transaction ends. If it's not, you perform a rollback and the data doesn't change in the actual table
 
12:24 AM
that's possible in oracle, too. i'm just not sure how to construct the code that answers the question "is this data right?" my first thought was unit tests, but that doesn't seem right.
 
I think maybe you misunderstand unit tests
unit tests are typically in a separate part of the code (folder, project, whatever) and import bits and pieces of your production code
I think Jasmine is a popular javascript one
they exist to test individual chunks of functionality - is this class output correct, etc.
 
i get that. i was thinking of grafting the concept of unit tests onto the database, treating the data and the validation rules, as a module, and create should test statements for it
 
what you're talking about is validation - you just need to determine the criteria for an import being correct or incorrect
I think that sounds like an acceptable design
how many "rules" do you have? there's tools for that sort of thing if you're doing something complex
 
I'll need to flesh out the rules, too.
What tools are there for this sort of thing?
 
maybe if you could provide more details about the system you're creating, I could give more detailed answers?
for .NET, you could look here: stackoverflow.com/questions/8750208/…
 
12:29 AM
I'm importing standardized test data into our SIS's database. We're given either tab-separated text files, or microsoft access databases with this data. I need to extract the data, massage it, then import it into the database. And do it all while keeping tabs on if things are working smoothly along the way.
 
ok
 
i wish this could be asked on SO. it would helpful to get a survey on what tools and frameworks other programmers would use for this project.
 
the exact same as a poll of 'favorite tool or language'.
 
exactly. i don't need the "correct" answer here, just some suggestions on what to research and evaluate
 
12:46 AM
you know the pain of core software engineers
they usually decide which language / tools should be used for a project
welp. gotcha sleep. Almost 2am
 
1:12 AM
1
Q: Why don't CSS transitions fire when triggered via trigger.click

lacksInitiativeI don't understand why CSS transitions do not run when they are called via a trigger event but they do run when called via a mouse click. I'm referring to this jsFiddle. (My event hookups are at the bottom of the JS panel) <button id="notworks">notworks</button> <button class="dl-trigger">works<...

I was provided an answer that solved my problem but I don;t understand whats going on.
I thought buttons had no default action, so how does clicking one prevent the css transition from firing, or is it firing twice?
 
So easy to collect 80 grand these days
 
Especially if you have a popular YouTube channel ;)
 
@Retsam I think he says "I have approximate knowledge of everything"
 
 
1 hour later…
3:18 AM
0
Q: Chaining HTTP post promises angular not in sequence

GeneI understand of using of '.then' to chain promises, but the application that I am creating still does not fire in sequence. dataFactory.getFirst().then(function(resp3){ //handling of resp console.log('one'); }).then(dataFactory.doSecond(val).then(function(resp) { //han...

Hi all, would appreciate if anyone could give some pointers? Thanks!
 
3:57 AM
@lacksInitiative this returns false.
 
@rism Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. For posting large code blocks, use a paste site like gist.github.com, hastebin.com or pastie.org
 
this.$trigger.on('click.dlmenu', function () {

                    if (self.open) {
                        self._closeMenu();
                    }
                    else {
                        self._openMenu();
                    }
                    return false;

                });
thus suppressing the event. But your other button still propagates it event which closes the menu because of this
   $body.off('click').on('click.dlmenu', function () {
                self._closeMenu();
            });
in the openMenu handler. So Henry's answer is simply preventing the body from handling the propagated event from the notworks button and thus closing the menu.
 
 
1 hour later…
6:16 AM
Guys need some help I am using form handling with ajax and php everything works fine but the data from the form is not being sent to the php script ! Here is my code : pastebin.com/g8dTjY9t
 
6:35 AM
@RizwanAhmed You haven't specified your form action
!!afk
 
I tried that way too it doesn't work !
@Ṣhmiddty Any other way ?
 
@RizwanAhmed Ṣhmiddty is afk.
 
lolz can any1 help?
 
The action you have specified is a relative url.
 
 
1 hour later…
7:49 AM
yo
anyone?
 
yo?
 
anyone experienced with leafletjs?
 
yo.
 
8:03 AM
anyone experienced with leafletjs?
 
yo.
 
yo.
 
yo.
@developer (Don't ask to ask; just ask; someone might know, but NOW they have to wait for you to actually ASK your question, which is annoying and cumbersome)
 
Maybe they just want to know if anyone's worked with leafletjs and that's the actual question?
In which case, no, never heard of it
 
Oh, right. I have worked with leaflet.
 
8:15 AM
hi all
 
Oh, new elections
 
read some threads about security, login, tokens, etc... with angular webapps. But there are many solutions... actually I'm going for this docs.google.com/drawings/d/… kind of implementation, with tokens (angularJS + php), is it a good/bad solution? any advices?
 
@MadaraUchiha bjb is still at it?
 
8:25 AM
@SomeKittens Looks like it
He's going to get to phase 2 it seems too
 
Looking around on SO, it turns out that stripping tags from a string containing arbitrary HTML is a hard problem
 
You got my endorsement.
aw, the other guy delete his message
 
The DOM is vulnerable to malicious HTML with event attributes
Regex solutions are buggy at best
 
@nhahtdh Depends on the context
 
^ If you trust the source, then it's OK to use the DOM method, via jQuery or DOM API
Throw that assumption away, and you get a hard problem
 
8:29 AM
@nhahtdh That's not what I mean by context
 
The good solution is to use Caja HTML sanitizer - the code is like a HTML parser
 
You want to allow certain tags but not others? Certain attributes, but not others?
 
Strip all tags. Well, even if you want to strip some tags, the problem is still the same.
 
Also, are you speaking about browser JavaScript? NodeJS? PHP?
 
Ah, sorry. I'm talking about Browser JS
 
8:30 AM
@nhahtdh Stripping all tags is easy
 
Just escape the string if you're worried about it containing HTML. Or set it as text.
 
261
Q: Strip HTML from Text JavaScript

BryanIs there an easy way to take a string of html in JavaScript and strip out the html?

 
let div = document.createElement('div');
div.innerHTML = myHTMLBlock;
return div.textContent; // no HTML!
 
Don't use this with HTML from an untrusted source. To see why, try running strip("<img onerror='alert(\"could run arbitrary JS here\")' src=bogus>")Mike Samuel Sep 22 '11 at 18:06
You lose the moment you execute the 2nd line
 
8:31 AM
Hmm, true.
@nhahtdh You could probably work something out with a DOMParser
 
Why not just escape it? :/ It all depends on your goal.. which is what, exactly?
 
True ^
 
@RoelvanUden If you look at the linked question - the problem is: you have a string which can contain HTML markup, you want to strip all HTML mark up and retain only the text
 
So you don't want to show <img /> and such?
 
(It's not my problem - just a problem general enough to have gazillion of dup on SO, but with very few safe answer)
@RoelvanUden Right, it's the point of stripping all HTML markups
 
8:37 AM
Right, that's a bit of a hassle to do. You'll want to use a parser
 
So far, it seems that Caja HTML sanitizer as mentioned in stackoverflow.com/a/430240/1400768 is the only way to do it
And it implements something like a parser
 
A near unreadable one but yes :P
 
@MadaraUchiha That one seems promising
Nothing is executed when I run:
parser = new DOMParser();
doc = parser.parseFromString("<img onerror='alert(\"could run arbitrary JS here\")' src=bogus>Yoyokjhskdf<b>sdfkdhsf</b>sghjsdfi", "text/html");
 
8:52 AM
@Zirak haha, i love it. havent been on hear for over 2 years and you're all still talking about me, with <3 xx
lol :D
how's everyone
 
9:03 AM
would the test == true?
 
Run the code and see for yourself.
 
I'd need to install jasmine and shit
possible just answer yes or no?
 
Anything 's possible.
 
crl
9:29 AM
slowly making my shit output.jsbin.com/pajabe, few bugs of course
 
pls that colors
it hurts :(
 
crl
me no designer, will remove the red tho
 
I know that feelin'
ez
 
crl
thanks, also I should use lorempizza for content :)
 
nice
 
9:46 AM
I might have a brain fart. The MDN says that document.getElementsByClassName wasn't present in IE before the version 9. What were we using before ?
 
crl
probably nothing, no idea
 
Hey folk! May I ask something?
 
@hansf. Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
crl
> Please don't ask if you can ask
 
Lol, you get it right
No it's not about technical concern, but about being a developer.
I've been working for a company for a year as a client side engineer, but feel tired and exhausted lately, you guys ever feel it too?
 
9:56 AM
@crl came after his entry :p
 
crl
yea right
 
@DenysSéguret tagName
 
crl
@hansf. idk, do some sport, eat fruits, sleep
 
@crl i accidentally moved a box out the border, so that it appears at the side. But i cannot return it ?
 
Yes I've done them actually, I just feel like , you know I saw a street painter, doing some painting and enjoying it, while I get higher salary than him, what I feel like this is not my way.
 
crl
9:59 AM
@KarelG do you have errors in console? which browser? can it really not move now?
 
you can rethink of what you really like, and look around for job opportunities. if found one, then you can consider to quit your current job or not
@crl it's the area of click. When horizontal, you can click anywhere to drag. But when vertical, you have to move the mouse to the box with the text.
 
Thank you, well not a serious concern but perhaps just a entry-level dev. matter.
 
crl
ah, only the sign ☰ is draggable, on purpose
 
it's not consistent :/
 
crl
the ☰ will be supposed to be placed on top middle after, like dis
 
it got shown several weeks before at imgur
 
user3119231
Good Morning, Ladies and Gentleman.
 
sieg heil !
Einen guten tag
 
user3119231
@KarelG maybe "sieg heil" isn't a good way to greete people :D
 
just a poor joke with your nationality
 
user3119231
10:34 AM
Yeah I got this :P
 
heh
 
user3119231
o/
 
user3119231
 
user3119231
But nothing tops this: codepen.io/dissimulate/pen/KrAwx
 
crl
oh react
 
10:44 AM
TIL checking battery status through js
what the hell ... why
 
crl
mobile
 
yes, but you can use the OS ... just tap the main button ?
(or top slide)
 
your app can make use of this information
 
yes
 
crl
s/make use of/sell
 
10:51 AM
actually if you combine battery status with 1-2 more metrics, you can make an identifier
for each user in the world :d
 
user3119231
modulo operator?
 
user3119231
what use=
 
crl
@Neoares what?
 
user3119231
$rest = $i % 2;
 
%
@crl you can track users using battery info
on mobile apps
 
crl
10:53 AM
@Maurize is i always >=0 ?
 
user3119231
yes
 
it's 1 or 0
what :/
 
user3119231
my bad.
 
user3119231
for ($i = 0; $i <= 100; $i++){
	if (($i % 2) == 0){
		echo($i."<br>");
	}
}
 
crl
it's ok then
 
10:54 AM
a suggestion for you all: use prime numbers in addition to that.
basic hash operation
 
for what?
 
crl
a la java
 
user3119231
I just need to understand what this % does :D
 
user3119231
Don't blame me for this -.-
 
it's a modulo
 
10:55 AM
@Maurize it's the remainder if the integer division
 
!! wiki modulo
 
Modulo may refer to: == Mathematics and computer scienceEdit == Modulo operation, in computing, the remainder after division Modulo (jargon), a word with multiple distinct meanings in mathematics Modular arithmetic: Part of a system of arithmetic for integers, where numbers "wrap around" upon reaching a certain value—the modulus. == Other usesEdit == Módulo, a Brazilian company specializing in IT governance Ferrari Modulo, a concept car from 1970 == See alsoEdit == Modulus (disambiguation) Module (disambiguation)...
 
for example, 7/4 is 1 and remainder 3
 
quick correction :p
 
no
 
10:56 AM
u were wrong first
I SAW THAT
 
crl
Euclidean integer division
 
I know
 
user3119231
@Neoares thanks, now I undestand.
 
7 = 4*1 +3
that 3 is the remainder
because 4*2 is 8 and 8>7
so it can't be 2 :P
 
user3119231
5 % 5 == 1 ?
 
10:57 AM
0
 
user3119231
Because nothing remains, right?
 
because 5/5 = 1
yes
 
user3119231
Thanks bros.
 
that's why i%2 is a good odd/even filter
because 0 = even and 1 = odd
 
i use ` myVar & 1 === 0 ` (true if even) :P
 
crl
10:59 AM
X = modulo * q + r, where 0<=r<modulo (definition of Euclidean division)
 
superfast with large numbers
 
@KarelG yes, that's faster I guess
because it works with binary numbers
 
all numbers are binary
 
I mean, bit per bit operation
 
user3119231
@crl Mind = blown
 
10:59 AM
^^ @KarelG
 
crl
@Maurize nothing complex here
 
read my correction :P
 
lel
 
user3119231
@crl excuse me :D
 
@KarelG actually that's true if odd
cause odd & 1 = 1
and even & 1 = 0
 
user3119231
11:02 AM
Same thing I thought for a moment...
 
user3119231
In fact & 1 isn't valid js or am I wrong?
 
idk, let me check
!!> 4&1
 
@Neoares 0
 
it's perfectly valid
 
it works
because && is for booleans
 
user3119231
11:05 AM
Ah right, my bad.
 
& is the bitwise AND operator
| is also valid
 
!!> "hello"&"bye"
 
@Neoares 0
 
user3119231
!!> 4 | 1
 
@Maurize 5
 
11:06 AM
that's 100 | 001
so 101
 
user3119231
Bitwise operators Operator Usage Description
Bitwise AND a & b Returns a one in each bit position for which the corresponding bits of both operands are ones.
Bitwise OR a | b Returns a zero in each bit position for which the corresponding bits of both operands are zeros.
Bitwise XOR a ^ b Returns a zero in each bit position for which the corresponding bits are the same.
[Returns a one in each bit position for which the corresponding bits are different.]
Bitwise NOT ~ a Inverts the bits of its operand.
 
actually they are ultra-usefull in some situations
 
!!> (5 & 1 === 0)
 
@KarelG 0
 
11:13 AM
^-- false
!!> (6 & 1 === 0)
 
@KarelG 0
 
OK ... jsfiddletime
ah, it must be 0
 
How do you guys handle repetitive asynchronous ajax calls where response from a ajax call initiate another ajax call and so on.
 
@Neoares : fiddle ... forgot the priorities
 
I try to avoid it :)
 
11:22 AM
trust me, I tried to avoid it too :(
is there any other alternative to recursion, cause recursion sucks in JS
 
If I do have to do it, I'd probably use events
 
@KarelG yes nvm I skipped the ===0
it's 1 if odd, so false because the ===0
 
!!afk surprise-meeting
 
s/meeting/motherf*cker
 
@sakibmoon Why does it suck?
 
11:25 AM
iteration
but sometimes recursion is better
 
the only moment that recursion sucks is that you handled it incorrectly, leading to StackOverflow exception ...
memory shouldn't be an issue
 
@RoelvanUden it creates new stack in every call leading to memory issue
@KarelG I would've to use Trampolining
 
What insane thing are you doing that you get recursion stack overflows with AJAX calls?
 
just noticed that for friday the 13th (tomorrow) you cna win a whooping 129 millions at EuroMillions o.O
!! try my luck or not
 
@KarelG try my luck
 
11:28 AM
OK
 
I am trying ajax call to handle 10 database update in each ajax call. Need to handle 10000 calls
 
...
transaction + combined ajaxs ?
 
@sakibmoon AJAX and Database are not strictly related.
So... context?
 
user3119231
@sakibmoon do one ajax request with data to php. Simply split data and insert it in php
 
I need to update a whole database which is going to take a long time and it's not going to be completed within the max execution time limit.
 
user3119231
11:33 AM
Then you need a new plan or increase execution time
 
I can't control the execution time. It's going to be used on a number of server of which I don't have any control.
 
user3119231
Then try to put all data into an array or something. Work with JSON and give it to serverside. Then simply use JSON again and put it in database.
 
user3119231
AJAX isn't doing anything into databases. It just communicates with the Server.
 
@Maurize increasing execution time should be done with caution
 
user3119231
11:36 AM
@KarelG because this I wrote it as least.
 
Yes. Ajax is just ensuring the communication and that's what I need to avoid the execution time limit.
 
user3119231
- removed because shit -
 
user3119231
2
A: Ajax - best technique for processing large amount of data

Graham RitchiePre-emptive caching. Basically your 'pop-ups' (god knows why you have so many - there must be a better way :-D hehe) will have a pattern or logical order or whatever. Using a combination of: Loading the Main / Most likely to be first used pop-ups data and storing that in a var. I would highly...

 
user3119231
this is much better.
 
what you can do is the following
1) client: group the data you have to update
2) client: send 1 ajax call to server with let's say 10 update informations (JSON format)
3) server: use SQL transaction (if too complex, simply UPDATE) to put the updates
4a) server: success: reply, proceed to 5
4b) server: failure: return reason, (uncommit transaction changes / update changes or other tasks, depends of goals)
5) client: IF (all updates not done) jump to step 2, OFFSET 10, sending next update batch.
5.1) client: else confirm updates (refresh page)
 
11:41 AM
All the data is in server side. I'm not passing any data from ajax side except a counter of how much data has already been processed.

The main issue is all of it can't be handled in a single call. I thought I can bypass it by doing the update in ajax and updating a little bit each time.
 
crl
output.jsbin.com/pajabe basic DnD, problem is that we have [A][B ------] (B larger) so when you drag A on top of B (left side of B), instantly it switches them so [B ------][A] but the dragged element is still A and is just after this switch still on top of B because of those different width, and it's on the left part of B, so it swiches again, and repeat forever
 
!! afk lunch
 
@KarelG that's what I'm trying to do. Thanks.

But to do the next batch, I will need to call the same ajax call again which is recursion. I was wondering if that's the only solution in my case.
 
Hi! What is the most common height of landing page screen (in your practice)?
 
crl
so how could I focking do?
@QueueOverflow 100%
 
11:46 AM
@crl Simplest way: flag on mousedown
 
crl
ok, let me think of that, thanks, but I want to continue the sortable thing as long as the user wants
 
@crl I will restate my question. What the common browser height of users, that look a landing page?
 
@QueueOverflow "Why does that matter?" would be the answer
 
@MadaraUchiha It matters to me, to a designer. I expect about 700 - 800 px, but I would to get more accurate stats.
 
@QueueOverflow It should not. Your design should look good in whatever height the user is viewing
You will never get accurate stats, because depends on your field and geographical area, more or less users may be using mobile phones, tablets, desktops with shitty res, desktop with good res, desktop with awesome res, or anything in between.
You can't know, that's why your design needs to be responsive to any viewport size.
responsive design isn't just about width, you know...
 
11:53 AM
@MadaraUchiha I know, but I can't make a design is liked by all, I can make a design is liked by most people.
 
@QueueOverflow Why can't you make a design that looks good in any resolution?
Lots of people do that, since rather long ago actually...
 
@MadaraUchiha Very good, you convinced me. I will try to think out something nice, something clear, something really responsive under the many other conditions. Thank you!
 
12:17 PM
Morning yall
 
Hey, I notice that the fastest you scroll on safari, less scroll event you get. It's really annoying because a need to set a div fixed when it raise the top of the window on scroll. But this behavior make that sometimes we can see a delay before the div is set to fixed (cause of waiting the next scroll event fired)
Do you know a trick for this type of case ?
 
@djsmiley2k Good day (15:21) :)
 
Hi, someone can give me a help? Im trying to have a link and when I click starts play a sound and when I click again stops the sound
I have here the example but its not working I dont understand why
 
Hey guys!
Im trying to attach a custom function to the window in javascript at the moment I have done:
window.DevTools = {setSignalRLogging: functionname}
 
wooo I fixed it `o/
 
12:32 PM
If there was previously a DevTools object defined would this completely overwrite it? or just add the setSignalRLogging property?
nvm i found out
window.DevTools["setSignalRLogging"] = functionname
hmm actually that didnt work...
 
lel
the second hit hurts more IMO
because it hits with the edge
 
love the part where she waits for moving the foot again and the otter moves before she does
he got the pattern!!
TIL otters are smarter than some ppl
 

« first day (1853 days earlier)      last day (3098 days later) »