« first day (20 days earlier)      last day (4933 days later) » 

12:00 AM
what's the problem there?
 
i wanted to make validation for the form so at least one element is selected
 
@sebastian and what if it's not?
do you bop them on the head?
honestly I don't understand the problem here...
29 mins ago, by drachenstern
you should always validate the values on the server because the client may disable javascript. You can never trust the javascript to run completely
 
the sql query will print out the full table that could be about 1000-2000 lines or more
 
@sebastian you're trying to find how to do a magic shortcut in PHP based on work done in javascript
that can't be done
 
if at least one element is selected the list is drastically reduced.
 
12:03 AM
@sebastian ok, let me try again
if they submit to the server, you MUST CHECK THE VALIDATIONS AGAIN IN PHP
After that, then you will still have the same values
 
Rob
Sebastian, he's just saying that you should perform validation on the server end as well as the client end, or you don't know that your data hasn't been tampered with. You can still create your query, limit results by that value, but it should be after you know your data is valid.
 
the values will still post to the server so you're going to have all 7 options available
you can't use javascript to build the query (ok, you could but I don't know anyone that would)
I think the problem isn't a javascript problem but a php problem
 
@sebastian listen to drachenstern here
if you're trying to create an sql query string in javascript, you're thinking along the wrong path
unless, of course, you simply are doing a silly personal project for fun and private use
 
especially listen to this: ;)
40 mins ago, by drachenstern
but I don't write PHP, so I'm not sure how to tell you to do this, I am much more familiar with .NET code
 
i'm not intending to do that.
 
12:12 AM
ah ok
You want to create a form validation of some sort in Javascript, correct?
You say you have 7 fields and you want one of them to be selected?
 
correct.
 
or you want any number from 1 to 7 to be selected?
but not none of them?
 
any of 7 but not none.
 
do you use jquery?
 
after the validation has passed to continue with a regular php query.
 
12:15 AM
ok
just keep in mind that what drachenstern says is correct...a user could very easily pass false data to your server, so you will need to validate twice
the front-end validation is just for show
basically
are these checkbox inputs?
if so, this can be easily done using jquery (and javascript, depending on your definition of "easy")
let's say you have some form #myForm
 
no, they are drop down boxes. built up in a while statement. basically i don't what the drop-boxes contain because they are populated from mysql
 
ok so i imagine your select elements look something like this:
<select name="mySelect">
<option value="0">Select a Hairdresser</option>
 
exactly :)
 
<option value="1">Hairdresser 1</option>
ok
so using jQuery, you want to check if any of your select elements have a value
that is done like this:
actually hold on, lemme test something
 
I thought he said he already had the JS side working
it's just a matter of how does he build the query on the server
how does he pass that information to PHP
 
12:20 AM
is that true, sebastian?
if so, how do you want to pass it? asynchronously via AJAX or as a form submission?
and do you use PHP with or without a framework?
 
yes. i have a simple js validation. i wanted to know how to continue with a php code after the js function checked the form.
 
ah ok
 
i'm working in joomla, as a component
 
ohhhh
ouch
 
see, these were the things I knew I didn't know
 
12:22 AM
i'm sorry to hear that
 
I don't do php
 
sigh
 
thanks @treeface ... I'm gonna duck out of chat now
 
sadly i know joomla well
 
12:22 AM
no worries..thanks for the help!
 
:)
is joomla that bad?
 
So how do you want to submit the form?
ajax or ...?
 
hey :D
 
i genuinely dislike joomla for a whole host of reasons
but as a way for users to get started on a simple website, it's fine
it's rough for developers
but I think they do MVC a bit haphazardly
hello, daniel!
still..that's not important at the moment
 
i don't need to submit the form to an specific file or something like that. i just want to know what the user wants to print out on the screen from mysql
 
12:24 AM
i need you to tell me more information
Ok
How exactly do you mean, though?
Sorry if this sounds condescending, but do you understand how form submission works?
I only ask because the way you're describing your problem makes it seem like you perhaps (maybe) don't
 
i do understand how it works.
 
Ok so let's step through, exactly what you want to do
You start at page X
as page X is requested, your server pulls data from a database and echos out html in the form of 7 select elements
Now let's say I'm a user on page X
I select a few of these select boxes....now what?
do i hit submit?
what do I expect to see?
 
yes, you hit submit. and a table is show according to the selections you made.
the table contains an serial export from a PBX.
the j! component generates reports of the phone trafic
 
ah haa
so
The user hits submit
 
the 7 boxes are, phone number, the date that the call was made, time till the call was answerd, duration of the call, and so on
 
12:31 AM
and this is an AJAX action, or a regular form submission?
 
regular submission
 
ah ok
So when you make this submission, you presumably submit it to some PHP page
what are you doing on that page?
 
i don't submit to an other php page
the results are shown under the form
restults (table with the query)
 
so the user makes a selection on page X
hits submit
and the form's action is page X?
 
and remains on page x but with a table below the form
 
12:34 AM
ah ha ok
now we're getting somewhere
 
it has no action
 
so then how does the information entered by the user get to your PHP?
how do you know what type of query to run?
 
the query is cobined with the $_POST values
in an odd but working way
first of all i check what the user selected
if ex. $phone_nr="--"
 
ah ha
so the action of the form is <form action=""...
meaning it's resubmitting to pageX
 
i never added the `action`attribute
 
12:38 AM
that's fine...it automatically creates it
basically it resubmits to pageX
but ok
so you're saying you're getting the phone number like this:
$phone_nr = $_POST['phone_nr']
 
exactly.
 
and now you want to construct a mysql query based on the values you get
but you don't want where clauses to be included if the $phone_nr is '--'
so let's start our query string...
$qStr = "SELECT * FROM mytable ";
now you need to conditionally check things
 
$query="select * from table".$phone_query
 
not quite, but close
in mysql, you need to use the WHERE clause
in raw sql, it looks like this:
 
$phone_query=$q1.$phone_nr
and
wait
 
12:41 AM
ok
 
not finished
 
sure
go ahead
 
$q1 can be " WHERE phone_nr=" if $_POST['phone_nr']!="--"
or $q1="" if $_POST['phone_nr']=="--"
something like that
:)
 
ah ok
just a moment
 
12:58 AM
np
 
Hey sorry sebastian...I got caught up in a meeting and now have to run
post your question on SO and it'll get some answers
just be sure to be very, very explicit in what you want
cheers!
 
good luck at your meeting. thanks for the help.
for me it's bed time :) it's 3 AM in RO and i have to get to work in the morning.
 
 
6 hours later…
Tek
6:43 AM
good morning everyone O:
 
 
2 hours later…
8:25 AM
Code review! I'm pretty sure this rather crude load-and-sort function can be improved:
1
A: Sorting li's in jQuery loaded divs

Yi JiangYou can try using $.get or any other ajax functions to load the comments, then sort them using Javascript's sort function. The code would look something like this: var loaded = 0, sites = 3, comments = []; function getComments(url){ $.get(url, function(data){ comments[loa...

Surely there must be something to replace the loop + add() bit
 
8:52 AM
Hi Guys,
 
Hi there o/
 
I have been playing around CKEditor and I would like to create twitter plugin like twitter.com/about/resources/widgets/widget_list
Any pointers?
 
Tek
asdfasdf
man
I keep getting "an error has occured" and I can't type any messages
@naveen I just switched to TinyMCE from CKEditor. CKEditor is a pain to manipulate with Javascript / jQuery since the <textarea> isn't used and implements it's on javascript textbox.
 
Hi Guyz
 
Tek
hi
 
9:04 AM
@Tek: But I need to have a solution for ckeditor.
I like it
 
Tek
@naveen Ah, well in that case I'll let someone else answer your question. I'm doing something similar except I'm just now learning javascript and it was too cumbersome using CKEditor
 
I have already developed a youtube plugin..
To me CKEditor is cool.. Poor documentation though
 
Tek
a bit
 
Mornin' all
 
^ so true.
 
Tek
9:18 AM
@AndyE Morning yet again.
@Chouchenos Morning to you as well!
 
@Tek Thanks, 'ello to you too
 
@Chouchenos lol
 
while you're at it, we suck at units of measure too
 
True, but didn't find the picture illustrating it yet.
 
and yes, it's more than a little funny to me given america's history...that we're on the imperial system
 
Tek
9:23 AM
If you guys could give a hint to his question to help the fellow @sebastian from the PHP room.
http://i.imgur.com/QbYI8.png


He said the following:
http://chat.stackoverflow.com/transcript/message/81032#81032
 
0
Q: Turn a .htc file's contents into 'regular' Javascript

anotherdaveHi, I have a .htc file whose behaviour is attached to a div in my page (div#test). Within the file, there is a tag at the top, setting up the behaviour: <PUBLIC:ATTACH EVENT="ondocumentready" FOR="element" ONEVENT="function1()" /> And throughout the file, there are calls to 'element', &...

^lol at the syntax errors
actually, it's only one syntax error. The other two issues are just a lack of understanding.
 
9:40 AM
!evening
Ehm..
Morning
 
mornin'
 
Tek
morning @Raynos
...
err, enter fail
There, fixed.
Guess we'll be the familiar faces most of the time eh?
 
@Tek unless you go away
 
Tek
@Raynos I like the warm welcoming feeling from the users around here. =)
 
Hello fellas
 
9:54 AM
yeah, this chat room is friendlier than my actual friends
 
@Greg doesnt get sarcasm
 
Tek
lol!
@Raynos The same could go for you, no? :)
 
@Raynos neverrrrrr.....
 
@Greg double sarcasm :(
 
Hi all
 
10:05 AM
Hi @JacobRelkin
 
hilo
 
Tek
@NickCraver What language is that greeting?
 
Hi Nick!
 
greek, with a touch of hungarian
 
Tek
@NickCraver I hope you're not being serious. I may just be gullible enough to buy that.
 
10:08 AM
you've seen me answer SO questions, yes? then by now you should know that I have no idea what I'm doing or typing
 
Tek
q:
Ah, agreed.
 
new redis logo: redis.io/logocontest
i'd have all the holes empty and a splintered square one halfway hammered into the round
 
Tek
man, that must have been a hard pick
a lot of them are pretty good
 
Man, I cannot tell you how annoying it is to have to do a hasOwnProperty check in for..in loops.
When the hell do we ever use inherited properties anyway?
 
aye, fairly annoying, if it's low performance then I'll use .each() just so I don't have to type it repeatedly
 
10:14 AM
@NickCraver Ouch, there were a lot of "I-follow-a-photoshop-tutorial-to-make-a-logo" in that contest...
 
If the next revision of the ES spec doesn't lay out some changes to the behavior of for..in, I'll be very upset.
 
same with most contests, several very good ones tho
@JacobRelkin - it does, that's what .keys() is for :)
also .getOwnPropertyNames()
 
Hmm don't know why I didn't see those
Thanks
 
trying to find resig's post he did short examples of the handy stuff
 
Beautiful
 
10:17 AM
Object.keys = function( obj ) {
  var array = new Array();
  for ( var prop in obj ) {
    if ( obj.hasOwnProperty( prop ) ) {
      array.push( prop );
    }
  }
  return array;
};
not a bad way to stick it in today
 
Yeah
I might like a prototype variant of that too
 
need to calculate number of weeks between two dates. How can i ? Thanks
 
Object.prototype.keys = function() {
var array = new Array();
for ( var prop in this ) {
if ( this.hasOwnProperty( prop ) ) {
array.push( prop );
}
}
return array;
};
 
not sure how many browsers support it, I know FF/Chrome do, so I assume safari, should be in Ie9
IE8 has it, I'm impressed
 
Sick!
 
10:20 AM
wait no, it just throws an invalid error
the error in the test is incorrect, status quo
 
Ha. I am not surprised
 
time to wake the better half up, back in a little while
 
Yeah same here
 
@NickCraver That code can throw errors in IE under certain circumstances. It also doesn't account for IE's DontEnum bug.
5
A: How to list the properties of a javascript object

Andy EAs Sam Dutton answered, a new method for this very purpose has been introduced in ECMAScript 5th Edition. Object.keys() will do what you want and is supported in Firefox 4, Chrome 6, Safari 5 and IE 9. You can also very easily implement the method in browsers that don't support it. However, ...

^ That version (or a variation of it) should be in Prototype 1.7.0.1 when it's released
 
10:41 AM
$("#LabelTypes_tbl").bind("dblclick",function() {
                alert("O");
            });
Whats wrong with that code?
 
@Raynos: nothing that I can see. You setting it after the document is ready?
 
Yes
I have an issue with deep copying that event over I think
humbug
$.fn.close(false) ignores events right
Is there a bshallow cop?
 
Tom
Hmm, I have a problem. I need to share a git repository, however I have a file with a password that goes ages back. I basically need to remove the password from the history but keep the file changes intact... great.
 
11:00 AM
@Tom: why don't you change the password where it's required?
@Raynos Not sure, I don't work with UI much
 
I mean is there a shallow copy with events
 
Tom
@AndyE git filter-branch --tree-filter "find . -type f -exec sed -i -e 's/originalpassword/newpassword/g' {} \; seems to do the trick I think
I always used SmartGit, an interface, so I'm quite bad with git console
 
k
@Raynos not sure, maybe @NickCraver knows?
 
hi there
anyone can help me with a little interpolation issue?
 
almost back for the day, will take a look in a min
there's no shallow copy of an object with events, no...since they're not even stored on the object
you can copy it's $.cache entry if you want though, be sure to increment uuid exposed in 1.4.3 iirc
 
11:17 AM
@IvoWetzel what's up?
 
@IvoWetzel bang the magnet harder until it reverses
 
@AndyE I've got a bezier curve I move an object along, now I need to factor in acceleration
I can calculate the speed at a given time, but I don't know how to factor that into the bezier calculation which also takes a time value
time is 0.0 to 1.0
 
bezier curve is the one with two startingpoints and two gradients?
or 4 points ?
 
@Raynos mine has 4 points
    function linp(d, a, b, t) {
        d.x = a.x + (b.x - a.x) * t;
        d.y = a.y + (b.y - a.y) * t;
    }

    Ship.prototype.bezier = function(dest, a, b, c, d, t) {
        var ab = {x:0, y: 0}, bc = {x:0, y: 0}, cd = {x:0, y: 0};
        var abbc = {x:0, y: 0}, bccd = {x:0, y: 0};
        linp(ab, a, b, t);
        linp(bc, b, c, t);
        linp(cd, c, d, t);
        linp(abbc, ab, bc, t);
        linp(bccd, bc, cd, t);
        linp(dest, abbc, bccd, t);
    };
 
11:22 AM
@AndyE Thought I give it a try here first, but well gonna post it there then
 
Mess around with gradients :)
Dont know whether theres a calculus library in javascript
 
I was hoping for a rather simple solution... this is just for graphics, the ships travels between 2 planets(aka circles) and it has a different rotation speed on each planet when the sizes differ to much the ships stops abruptly on the new planet which just looks bad
 
@IvoWetzel Oooo... bezier curves :D I use them all the time, yet still never bothered looking up the math behind them
 
@YiJiang Neither did I... :P
 
Am I the only person who learnt what they are? :(
but I cant od maths anymore
 
11:50 AM
weeee performance appraisal time, there goes the next 2 hours
 
1
A: jQuery/Javascript css("width") / check if style is defined in css?

PekkaI have a workaround idea that might work. Define a class named default_width before all other style sheets: .default_width { width: 1787px } /* An arbitrary value unlikely to be an image's width, but not too large in case the browser reserves memory for it */ to find out whether an ima...

I have to say, I lol'd at this answer
 
@bobince was correct there..real shame curCSS isn't exposed in jQuery anymore, only the hooks version is...really should expose the old one as well
 
@NickCraver He is, of course, but the workaround is one of those "so stupid it might actually work" solutions :P
 
Tom
@AndyE, for some reason that command seems to corrupt my binary files like images, do you know why?
 
@Tom: not sure, sorry
 
Tom
12:04 PM
Alright, looks like I'm finally being punished for sticking to the gui version of git :p
 
@Nana: would you mind to stay forever in this channel? Just for decoration :p (j/k)
 
@jAndy: I think you scared her off
 
indeed
 
damn, now I've got that stupid "na na na" song in my head
 
@AndyE: there are a zillion "na na na" songs around, be specific!
it would be really confusing if my nickname was eAndy instead
 
12:13 PM
@jAndy Does it matter? He's got a "na na na" song in his head, and now, he's doomed! Doooooomed!
 
@jAndy: the new one by My Chemical Romance. It's really overplayed over here.
 
my curse these days is BARBRA STREISAND aaahhhhhh!! It owns me
and now I will curse you too
 
12:26 PM
@jAndy Lets keep things proffesional shall we.
@jAndy Your a very silly man
Ok, what causes this really annoying console not defined error in firebug?
 
@Raynos: not having the console open, maybe?
 
@AndyE Nothing to do with that. It just tends to crash 1 in 20 times and forces me to restart firefox
 
@Raynos: I don't do much Firebug debugging
 
firebug's net panel > chrome's resource view
that's the only thing I miss
 
Tom
Sorry for being offtopic but does anyone know of some source explaining the "find" command of git tree-filter ? git filter-branch --tree-filter "find .
 
12:42 PM
company wants ie & firefox support. Like hell am I debugging in ie. Chrome isn't a choice.
 
@Raynos Not that bad, as long as it's >7. The developer toolbar is not as awful as IE itself compared to the other browsers
 
@NickCraver: yeah, I much prefer Chrome's console and DOM view though
 
@Raynos - most of our users are Ie7/9, I still dev in chrome, test in the others
@AndyE - mostly agree, however not being able to insert a return in chrome's console is insanely annoying
 
@NickCraver: yeah, that bugs me too. Shift + Enter, is it so hard!?
 
yeah why the hell wasn't that added in the past 9 versions
 
12:49 PM
@NickCraver: maybe nobody opened a request for it? :-P
 
i'll open a request to poke them in the eye
 
The console I've been building is styled after Chrome's, but one of the first things I did was implement shift+enter
 
@YiJiang Its hidious :(
 
@Raynos Be thankful that it's there at all.
 
that's more messed up
it's supposed to be alt+enter but that doesn't work, they're proposing ctrl+enter to fix it
shift+enter is standard.....wtf?
 
12:52 PM
lol ridiculous. alt+enter pings at me. What's wrong with shift+enter?
 
"Multiline commands in the Javascript Console work fine in Chrome for OSX 5.0.375.99 (Official Build 51029), just use alt+enter to add a new line. But alt+enter doesn't work in Chrome for Windows 5.0.375.99 (Official Build 51029); you just get an error "beep" and no newline."
 
@YiJiang But I cant even write to the console in ie. It has no api :(
 
mentioned at google I/O
 
I've never seen an application use Alt+Enter for a line break. Most IM apps use Shift+Enter on Win
 
linux too
 

« first day (20 days earlier)      last day (4933 days later) »