Archive for August, 2007

hi im experiencing an extrange behaviour with a call to an external file with JavaScript code i have to load two

I found that document online, but how can i integrate these changes into my application: http://groups.google.com/group/Google-Maps-API/browse_thread/thread/b74bad232d8d2e28?hl=en ?

hey if I have a number that has a decimal point in it… is there a method to chop the decimal point and everything to the right of it off?

How can Reddit be so fast with Ajax?! Digg has a clear delay every time you dig/bury something, while Reddit just instantly switches colors and apparently registers this change. How can this be?

sure that its already saved?

a guess: because the colorswitching is done purely at clientside (everything preloaded) and the "saving" of the setting is done via AJAX in the background

Well… um…
I… guess.
Then Digg and all other sites must be very badly coded.
Well, in Digg's case it's obvious

very badly coded?

Yes.

var x=document.createElement()… var y=x; - is Y a copy of X?

Since you "feel" the delay.

if Reddit changes colour immediately before waiting for a response from the server to confirm that the change has been made then I'd say Reddit's not too hot

no

in all browsers? are you sure?

yes

hello

uh
when i do this
http://pastebin.com/m2ffd5c08
the select field has two rows, first says Fist and second is empty
why is there a empty row O_o

Can anyone help me on a little row visibility thing? I simplified everything to the simplest way that is possible. Just view the page in FireFox and click on 'Merk 1', and see what happens. http://www.q13.nl/libohorloges/

its an issue @ opera xD

nevermind, fixed
Firefox seemed to like display = "" more than display="block"

'mornin

hello

?

looks ok

hmm, for some reasons I don't have the alert though

, is it possible to change this var from within the body?

Like onclick

you can't define a var inside the head tag, js is not that tightly coupled to the DOM
it will become a global variable if it's at the root of a script file

is in the head of the document

does that make it global?

it doesn't matter where you put the script tag

So how do I make it global?
in the root of script file?
How do you mean?

var foo = bar; outside of any function, or omit the var prefix (in which case you can do it inside a function body as well)

hmmmm
because my var is defined outside of the function[s]
so i just hafta remove the var!
Not working, hmmm
Raevel, I defined num = 0; outside of the funtion and when I click it is not changing
Raevel, does this look right:? onclick="javascript: num = 2;"

level9wiz don't put "javascript:" inside events

I just noticed that on google lol
Hmmmm
still not working
Not getting any js errors from the browser tho. js is on and working on other componenets

Hi. Is there a simple way to catch the event of clicking on a checkbox?

Raevel, onclick="num=2" ? That should work right?

is there a difference between an object with numerical properties and an array with a sparsely populated index?
(are numerical properties even legal?)

an array has the array prototype associated with it

`js watch

and the ahref is overriding it

and, properties are always toString:ed

var obj = { 13 : "return", 9 : "tab", etc }; alert( obj[ charcode ] ); ?

looks fine

no, illegal! you go to jail!

if not, then use an array
it's legal

mutilator - i ask because my coworkers tend to clone my code a lot, so if it learn later that I did something that isn't quite right, i've institutionalized bad code practice

heh

i know, cloning code is already bad practice

a= {1 : 23}; a[1]; is fine, at least in the 'shell' bookmarklet

i'd use an object for that, since the property names are of significance

Anyway to make the onclick event override the ahref? I need the href for rel="ajaxtab" but i want to use onclick to handel some functions

a href="" onclick="fCall(); return false;"

Raevel - that's what I was thinking, just wanted to check

does anybody know if the [object].watch works in IE6?

it doesn't

thanks

frames.parent[0].location.substr(0,20) -doesn't work?
when i console.log the "frames.parent[0].location" i get http://www…../main_content.php href=http://……main_content.php
frames.parent[0].location.toString returns "toString"
I want to check whether a url of a frame is as expected

.location.href

ah
yes was about to say .href etc don't return a value
thank you

hey, i have a simple form (name:, function:, submit..)
i would like to add a "Add another user" button
so that JS print another form with a specified id

toste - do you really want another form, or another input inside the current form?

another input

hello, can I add a method to a DOM tag, as I 'd do, for example, for a string string.prototype.myfunction = fucntion() ?
I tried form.prototype… (for the from element!) but get an error: form is not defined :/

section?

I have to do an alert from inside the page, and that's an included php file, so i cannot modify head

what's the javascript function to scroll to an anchor?

you'll have to find y coordinate for target anchor
then, use window.scrollBy(0,anchorY);

are you freakin serious?
you can't do window.location or something?

"wnix" at 71.6.194.243 pasted "function to find Y coordinate from object" (16 lines) at http://erxz.com/pb/4126

no, it should work in the body too. But if you want access to a DOM element in this script, the script should add after this element to the body.

http://erxz.com/pb/4126

nvm, prototype has scrollTo
woot

or use eg. an event handler window.onload = function() {….your script… }

http://redditmedia.com

hi! can someone give me a hint on how to catch a key event (like keypress/keydown) in a certain svg object?

Hi all. How can I use the value of a variable in a regular expression in javascript? var x = 'taco'; othervar.match(/x/); clearly won't work

new RegExp (x);

big thanks leobm

I think I understand. thanks.

hey, a quick question, can javascript access contents on a CD?

no

not from a browser.

hm.. thanks
unfortunate..
any idea how i can load information from a cd like a file with records and display it in a browser?

in jquery?

like let's say my site normally retrieves data from a mysql database, but if i were to bring a laptop to somewhere with no internet access, i would like to be able to get some of the information into a CD and brining it around and still be able to do presentations using information from the CD.
is that possble at all?

$("#id").text() and $("#id").value and $("#id").html() does not work
Oops sorry - wrong channel

an alternative could be a signed applet.
or webstart application.
search in google for the keywords 'java webstart" or "java signed applet"

hmm, but that means i would need to code a bit in java..
alright, thanks for the ideas leobm, i'll be to reconsider my options
s/be/have

Im having problems with array.forEach-command, it does not seem to step through all items in my array but rather a random amount of them. Has anyone played around with this?

can you reproduce it?

yes

http://java-avm.sourceforge.net/

thanks leobm

java 1.6 has a javascript engine included. you can code javascript and can use java classes. look at
"Scripting for the java host Platform" google

Im using forEach because I do not add items sequentially but at scattered indexes, so I need to loop through the array and get the index where each item is located at.

leobm, thanks for the advice and help

the fact that you're using an array probably messes that up
use a regular object instead

how do you mean?
I have been thinking of using Hash instead, but a regular object is a new one

an array represents a list, if you scatter the indexes it's not a list, it turns into a dictionary

how do I check if a variable is declared?

typeof theVar !== "undefined"

ah cool ty

"raar" is not an english word

raar is undefined
I didn't know how to check before
'document.all.whatever.style' is null or not an object" - what am I doing wrong; http://www.french-property.com/scripts/tom/edit_mails.php ?
firefox works fine with document.layers

you should use neither of the two

hi

oh? what should I use instead?

it depends on what you are doing, but document.getElementById is one alternative

I'll give it a shot, ty

(typeof x!==undefinedl)
ups

I made an web application based on Chameleon GIS environment, my problem is that I want to make floating window which contains the keymap. I already made most of that part I can move the keymap layers into the floating div, but if I try to marquee the div that contains the keymap away from
the original position it loses the framing functionality

I mean I can't mark a part of keymap to be displayed on the main Map, except if I move back the floating div to the original position again

Does anyone have any ideas about why http://httux.htgm.no/statviewer/ just refreshes once and then stops in IE? The JS is http://httux.htgm.no/statviewer/statviewer.js (jquery)

hi, is there any way to get the document height? (not window height)

the main problem that the Chameleon make such stupid implementation of this part it just work with document.write, when it creates the keymap layers it scatters them all over the document

script language" (25 lines) at http://erxz.com/pb/4128

http://erxz.com/pb/paste so uh
ehr
http://erxz.com/pb/4128 why does this have results like x: 1.9000000000000015 // y: 0.7900000000000005 O_o

so I'm looking through google's map code
look what I found…
if ("GMapEZ" in classes) { … }

lol

Here we are checking if a property named "GMapEZ" is present in the object "classes".

ya I get it, its kind of clever. I didn't know you could use the 'in' inside an if statemen
t

Probably because of the internal storage format for floating-point numbers.

oh boy…
i so hate computers xD

lol, this is funny
alert(["Your browser is not capable of displaying", "Google Maps on this page. Try using Firefox:", "http://getfirefox.com/"].join("\n"));
they're not a fan of just using \n in their strings eh?
such overkill

Search for the article "What every computer scientist should know about floating-point". It's floating (pardon the pun) around somewhere on the 'Net.

That article is kind of intimidating for beginners…

That's life. :-)

Wikipedia explains the same thing is a bit simpler terms.

document.write("" + "script src=\"" + src + "\"" + " type=\"text/javascript\"" + "/script");
why did they split the from the script?

Probably because they were worried the browser will parse it as a new opening tag and they didn't properly comprehend the concept of inline JavaScript.

:/

hm.. yes.. older browsers.. right
seems like excessive paranoia, but it can't be that bad

so

It is stupid.

what happened to the "the computer only does what you tell it"? :P

I'm really laughing at google's alert box

that wouldnt be true in this case
O_o

alert(["Your browser is not capable of displaying", "Google Maps on this page. Try using Firefox:", "http://getfirefox.com/"].join("\n"));
the same *exact* thing could just be

All you have to do is use DOM methods, or if you insist on living in 1995, say <script instead of script.

alert("Your browser is not capable of displaying\nGoogle Maps on this page. Try using Firefoxnhttp://getfirefox.com/");
but I bet the guy who made it got excited when he learned what join could do
and wanted to use it

what happened to the "the computer only does what you tell it"? :P # what are you talking about?

LMAO.

Does anyone know if it's possible to unit test Ajax?
…and if so.. what framework is good for such a task…

hi
how can I check the domain the user is navigating to on unload?

I doubt you can. Atleast I hope you can't

how can one check if a value is undefined?

yeah, i was doubting it too.. I was telling a coworker it would probably be a security risk if you could

myVar === undefined
or

it would be possible to examine where they are going, see that they are leaving, and say "HEY! GET YOUR ASS BACK HERE!" and force them back :L(

thanks, wnix

typeof myVar === "undefined"

the first example did not work
alright
thanks

myVar === undefined works, as long as myVar has been declared
myVar === undefined

Error: Error: ReferenceError: myVar is not defined at line 0: (null)

var myVar; myVar === undefined

true

function f(myVar) { return myVar === undefined; } f();

true

var obj = {}; obj.myProperty === undefined

true

typeof(something) == 'undefined';

true

that kind of defeats the purpose mostly
but thanks for playing.

"kind of defeats the purpose mostly"?

mostly

document.myForm.array[0].value, where array is an array of strings and contains the names of the form's elements (to put it in a loop)?

depends what your purpose is mostly

because I'm not declaring the variables
so it wouldn't help me
but the other one does

why not?

it's cool

you can still test for them as properties of the global object

yeah, the other example works fine

this.myVar === undefined

true

document.myForm.array[0].value = "someValue"

no

"array" is not connected to the DOM.. right?
not directly.

myFormElement.elements[inputName].value = someValue;

deltab, hum.. I'll try that

you shouldn't use document.myForm, by the way
use either document.forms.myForm (or document.forms['myForm']), or document.getElementById('myForm')
I represented those above by myFormElement

ie6 seems to be having problems dealing with inserting a row into a table using javascript
or is this a programming error on my behalf

deltab, what is myFormElement? the name of the form?

depends on how you are inserting the row probably

no, the form element
as obtained through document.forms.myForm (or document.forms['myForm']), or document.getElementById('myForm')
or the form property of an input

new Insertion.bottom("tblid",…)

try using the table's tBodies[0] instead
it looks like it checks for insertion into tbody and tr, but not the table

is there a cross browser compatible function to check pageYOffset?

you can't read CSS values if they have not been set with JS before"

is this true?
pageYOffset — what's that supposed to measure again?

what part of the page is visible
like when scrolling

so… the just the window height?
because that's not what Mozilla says
"Gets the amount of top page content that has been hidden by scrolling down."

ok well im looking for a cross browser version of that

this? http://msdn2.microsoft.com/en-us/library/ms534618.aspx

Agamemnus does scrollTop apply to the scrollbar on the browser as well?

hello~

i don't know and the page isn't opening anymore
hello

hi!

what's up?

hi, getting started with Javascript - I can put a style property for a div in a var, but how to show the current value when viewing the page containing the div?
some simple plugin for Firefox maybe?

Does anyone know if it's possible to unit test Ajax?

attachment_array = attachments.split(/,/,attachments); — for some reason attachment_array is not an array, hmm how can i makeit an array ?

so… is it all just people comeing here to seek help without anyone helping? ^^;;

..and if so.. what framework is good for such a task…

that's right, Princess^^.
coppershade-org^…

you can't read CSS values if they have not been set with JS before"

"unit test Ajax"?

Uh.. yeah. Does that sound right?

no, it doesn't.
what are you talking about?

hi… does somebody knows how can i discover when a window is minimized and when it isn't?

I guess I should say "integration test" but without opening/closing the browser eeach time
*each

ok so I'll ask the question I am here for… =P

Selenium is too heavy for my purposes

BARBA_RUIVA, might be a bit difficult

so basically I am using javascript to do an animation and I want the page to go to another page at the end of it
but I don't want to use like window.location.href = newpage or something

BARBA_RUIVA, look at the screen.height / screen.width values, the browser's natural height and width window, and the current window size.

cuz that kills the back history -.-

window.location.replace("http://google.com"); - the history remains unchanged

how can i populate an array from str.split(/,/) ?

does it?
hmm
let me try

Princess^^: yes ma'am, that's the poitn of the function
Princess^^: compatbility is questionable

Agamemnus, i will try

var ary = str.split(/,/);

i tried with window.onblur… but is not exactly i need
Agamemnus, thanks!

DDustin, thxs

Can the var top be used as a global variable for iframes/anything within a single browser window?

iframe communication is tricky, google it
also, firefox recently released a patch to "fix" an iframe "exploit". FF 2.0.something might make it impossible now

My company uses iframes in their product, which is IE only, and I wish their was an easy way to just declar some js library once and all "child" frames/whatever will have access to it

nopes thanks for the suggestion tho
think Ialready tried that one before too
window.location.href = nextpage works for firefox but not safari -.-
on safari it kills the history

who cares about safari

errr…

how does it kill the history?
you mean the spanish iphones? -.-

otherwise I wouldn't care

look at the mac history
if it's something other than "undefined", maybe you'll see how to fix it
well, safari history
also, is it safari 3?
someone earlier mentioned buggy javascript in that

any of you familiar with the safari, back button, iframe ordeal?

enlighten us

does anybody know a way to move an iframe inside the domtree and prevent a reload of the frames contents? insertBefore does moving, but the framecontents reload.. ?

Agamemnus:safari 3, the history looks right just the back function that won't work right

safari doesn't add iframe pages to history
also doesn't add #hashes

http://bin.cakephp.org/view/1738437074
anyone can check whats rong in there ?

http://www.streampad.com/blog/?p=110

hi!i have a definition of document.getElementById(idSTR).style.backgroundColor = '#FFFF99'; in firefox it works, i get to see the background color butt in Internet Explorer it doesn't show
is it diferent the sintax?

oh well thnx guys… I'll figure something out

I have a question about IE6
tavares, no, I don't think so. probably you did something funky with the id
in IE6, on the first reload, sometimes images don't look right (too big in height/width etc.)
and then on the second reload everything is fixed
does anyone know how I could fix this?

press reload?

thank you, i'm here all week

but I want the images to look right all the time
i don't know why this is happening

because webprogramming sux

seriously it does
nuthing comes out right

Agamemnus:

nor cross compatable

Princess^^: yes I double checked and window.location.replace does just that

try reload like that:
window.location.href=window.location.href;

safari is a browser that is lacking, I doubt it will allow you to move w/o modifying history

lol

if you have server acess you could do a 403 redirect or whatever the number is

wnix, no

Princess^^: yes that's the correct way to do it, if you have control over the server

I don't want to reload my page infinitely, or even at all
I think it's because the height and width attributes somehow get distorted..
I had this problem before too

iwas the "#" before the code of the color it as to be without it…

tavares, what?
tavares, oh.
idk
i'm just a noob

window.location.reload(true);

try preloading the images?

I don't think it helps

..oO ( is my question that unclear or the domtree too tricky ) ..

but how do I preload an image anyway?
rnix, idk.. i don't use iframes =\
wnix, but wouldn't the reload the page?!?

hmm well when I do window.location.href = nextpage; at the start of my function and comment out all my animations it works… must be an issue with my timers somehow

here is my code for preloading:
function cacheimage(curimage) {var preload_hoverimage = new Image(); preload_hoverimage.src = curimage}

the issue is tho then it requires 2 hits of the back button instead of one.. which I could live with

It don't work Agamemnus

what the heck
wnix, rnix?

hmm, sorry. hover images with javascript? did i missed something?
no hack, i'm another

rnix, what?
rnix, what hover images?
I just pasted my image host preload code and I was asking whether it's correct

just because you types preload_hoverimage in your example code

var myImages = []; function cacheimage(curimage) { var preload_hoverimage = new Image(); myImages.push(preload_hoverimage); preload_hoverimage.src = curimage; }

oh yeah I was doing something else with that code earlier and forgot to rename it

now works

is it not possible to just define your hover functionality with css?

… wrong hover.

ah

wnix, that just loads them all into an array. i'll try..

yeah
ah global array
in your version, when function ends, the variable with image will be deleted

i know, but doesn't that still load the image into the browser cache?

hummmm
I think so
=/

maybe it is some other problem
it's pretty rare
do you use IE6, wnix?

IE7 too
my IE6 is standalone

can you look at my site and waste some bandwidth clicking the links?
and then tell me if anything gets distorted
maybe it is just an IE6 issue
http://www.flyingsoft.phatcode.net/flowers/index.htm if you want..

yeah… bugged
when click in any item of menu

var id = document.getElementById('id').value;
that will give an array with of id='value' ?

or will check for id='id' ?

get the value at element and place in variable id

what happens when you click?
you mean images distorted or something else?

uh

Agamemnus, i have tried without results here… do you know some example in the web?
i dont understand exactly you means when you say to check window screen

Hello all, I'm having a strange problem with Firefox where I have a frameset, and I use onload in the frameset, yet the child frames have not completely loaded… I thought they were supposed to be completely loaded before load triggered ?

images distorted

http://bin.cakephp.org/view/699064378
the remove function does not work
wnix, any idea ?

Agamemnus, sry was away, sure you can. Angus PNGfix reads CSS properties.
I know it was ace_noone who said it (before I joined probably) but you gave it to me

coppershade-org^, I thought you had a problem with the same thing earlier?
anyway, thanks I will look at that later.. I changed my div to be made in javascript code instead already, though

is to possible to use multiple statements in a case switch? for example: switch( i ) { Case 1, 2: alert("ok") }

ron_asheton, yes
case 1:
case 2:
alert('foo'); break;

or you can do this:
switch(true) { Case ((i==1) || (i==2)): alert("ok") }

can somebody point me in the right direction for controlling an embedded quicktime movie with javascript?
document.getElementById("movie").stop(); isn't cutting it
got it
http://developer.apple.com/documentation/QuickTime/Conceptual/QTScripting_JavaScript/bQTScripting_JavaScri_Document/chapter_1000_section_5.html

err
how do I get the text width of a ?

Agamemnus, I meant that

meant that?
meant what?

Agamemnus, Case ((i==1) || (i==2)), this kind of syntax. thank you

oh, ok.
sure.

You know all those sites which let you choose a country and then it shows a list of cities or "sub areas"? How do you get this information? Is there a global database?

obviously they have the money to hire monkeys to find out
you can try mining wikipedia

"Information age" indeed…
Sadly, the information is mostly crap. :P

mostly

What do you mean by "mining Wikipedia"?

does anyone know how to get the text width of a element or even to center it…

You do that with CSS.
text-align: center;

with javascript
center on a div
you can download the appropriate files from wikipedia using your own program or javascript
you can extract the cities from the files

What files would that be?

or maybe google has something

What articles are you talking about?

http://en.wikipedia.org/wiki/Cities
List of cities by country
List of cities by latitude
List of metropolitan areas by population
etc..

I wonder how reliable that is…
Or even how complete it is.

http://en.wikipedia.org/wiki/List_of_cities_in_Afghanistan
as reliable and as complete as you can hope for.
55°43'N 12°34'E Copenhagen Denmark

there is a .mil site with a similar list, though probably not the ancient times and middle ages stuff

zhttp://www.infoplease.com/almanacs.html
http://www.infoplease.com/ipa/A0001796.html

is it possible to load google maps on an ajax loaded page? i want to init the load() function inside the ajax page

is there a window.close() that works in FF?

zombor, sure, why not… try iframes?
migs, isn't that a security risk? :-|

iframe?
cant use that

not in this case

sure, but that's probably why you can't find it in mozilla

so it's IE-only?

im trying to load google maps inside a jqmodal dialog box with custom php host variables

maybe you can find another way
did you look in mozilla's developer-mozilla.org thing?

I guess it's okay if it's IE only

zombor, idk

hmmm

any body know about using Javascript with Chameleon GIS Environment
??

the ajax doesnt load with all the google scripts in there, but it will load without ajax

I doubt there's a way to automatically log out the user after they hit the close button, is there?
or is that just a retarded question?
nm, it's a retarded question

yes
pretty retarded… try onunload?
ppl, i have no idea what the ajax is so….
zombor, ppl*

im using jquery
http://kenoshaareachamber.imagemanagement.com/member_directory.html

add it to the button's onlcik event

tells me nothing cause I never used it
close button in the browser.

how do I force a variable to be type string?

ron_asheton:

so I missed something : )

somestring = ""

what do you mean by "what the ajax is"?

Agamemnus, I mean some method like parseInt( variable );

^migs^, you can use cookies if the user wants to log in again and use a cron script to monitor last-known-activity-time
idk, ron
zombor, well… Idk. IDKKKKKKKKKKKKKKK

ok

lol

use an iframe
if you're somehow inserting the google script in, look at namespace conflicts maybe

i cant use an iframe
like i said

use ajax

i am using ajax

everyone should use ajax

thats my problem

if the page you're trying to load uses javascript you'll have to manually parse and eval it tho

What is the syntax for making a new Object that is basically an array (as I'd like to add my own functions) ?

or if there is a lib that does that, tell me!

in the ajax loaded page

that might work

amf, somearray = new Array()

it doesnt work
i get an error back from jquery

and then add to it by doing somearray[0] = 1; somearray[1] = 2;, etc.

I could set up a cron script on their computer that monitors the cookies. If the cookie says it's okay to log out, then it logs out

I wrote a function which loads a page with ajax, parses the script tags and eveals them (when its a src=".." script tag, pull in the file with ajax first and eval the content)

^migs^, nono you got it backwards
^migs^, save their login stuff to a cookie and use the cookie data to automatically log them in if they want to log in again

myeah, a friend had the exact same problem, even with the js parsing and evalling it wouldn't work
)

^migs^, then use a cron script to track their last login date and use a timeout value to check whether they're still logged in

=(

I think he means his own namespace, as in
var awesome = { cool_alert : function(a) { alert(a); } };
awesome.cool_alert("blah");

cron script on the server

right amf?

of course the first part is not what you asked, but it would help

so i cant have javascript in a page loaded with ajax

the matter would be clarified if we knew why you want to log out the user if he closes a window and how "logging out" proceeds

you can, but the simple ajax scripts you find on the net won't evaluate the js contained in the page you load

function NewArray() { this.prototype = new Array(); } this is closer to what I want, but wrong

so or extend these scripts or find a library that does

if your script just looks at the IP to test whether the user is logged in, that's different than looking at a cookie that gives the login info constantly
amf….. what did you want again?
"What is the syntax for making a new Object that is basically an array (as I'd like to add my own functions) ?"

hmmmm

ok, amf, try this..

I guess var NewArray = Array(); then NewArray.prototype.somefunc = function () { } makes more sense than what I just said

hmm, where it it…
maybe this is what you need?
http://www.w3schools.com/js/js_objects.asp
or you already know this?

I thought I wanted to extend Array(), but I just want my object to have the interface of an array but do different things for push(), pop() etc

is JScript.NET still based on ECMAScript? I can't get some features to work

hello collink

omg!

Do the thing i described
you can build your own namespace, so you can do methods such as .pop .push

you schoolin' nubs in here?

box is dropped down? this.offsetHeight doesn't change?

in my off time :P

LOL

s/\?$/\./;

seemed like you were helping someone just now

so you can var blah { = { custom_push: function(a, b) { alert("pushing "+a+" to "+b); } };
blah.custom_push("foo", "bar");
hows things looking with zeb? still doing work on the drift website?

not much

Is there a way I can use javascript host so that when a user clicks a button, it opens and closes their CD drive, makes their computer beep several times, and gives them a BSOD?

^Migs^: tell them to use IE
then just write code as normal.

nice
http://qdb.us/103393
whee

anyone know how to do that 'big pixels getting smaller as the image streams' for graphics-intensive sites?
is it done with some attribute of the img tag, for like lower res pictures?

sure
it's in my huge HTML 4 book
I remember reading it

anyone know of any existing conflicts with effects.js (from scriptaculous) and IE 6 ?

or even better, is it easy to write a script that loads a lores pic and stretches it, blurring it?

image something

and then fades the real pic into focus?

wait…..

I'd do it with the dxtransform thingy, but I don't know if it works on mac?

"Simply save your GIF or PNG images with the "interlaced" option, or your JPEG images with the "progressive" option."

ah

! that's why my images didn't look right (distorted) at the beginning

still a blurred image host that comes into focus would be even nicer

I don't think mozilla does that
coppershade
http://www.codinghorror.com/blog/archives/000468.html
it's basically the same as you said
I need to de-interlace all my images
dammit

hehe
exactly - but does JS have any processing power for fading a pic away on top of another - I mean rendering capabilities?

yeah sure, opacity
coppershade.. if you know photoshop, is there a way for png images not to be automatically named ____ copy.png?

box is dropped down? this.offsetHeight doesn't change.

Agamemnus, ??

alex25nj, test if it is selected?

I save pics as png all the time and I never got that

what version?

are you using ctrl+alt+shift+s?
I have CS2

no
me too
i used the dialog box

if you don't "Save As" but "Save for Web" it should work
I have a special grip for hitting ctrl+alt+shift+s in one go
I've programmed my hand :P

aight
can't you reprogram keywords?
i don't think you need to program your hand
i like "save for web", saves a few more steps too

how can i print out all the attributes of a variable?
theres some function but i cant remember the name

childNodes?

Test if a drop-down select-box is in a dropped-down state

onfocus or onselect.

I have a tooltip script that appears in the wrong place only when the select box from which it appears (onmouseover) is dropped down. Hiding it onmouseout, onmousemove, and onchange doesn't do it.

idk

does anybody know anything about the readystate attribute of embed objects?

Hi all
Hello
Is there a simple way to get a users computer name ?

no, just their hostname

Hostname meaning there net connections name
there has to be a way to get there physical computer name.. Its all on the itranet
intranet

well, sometimes it might be transfered in the user-agent string

hmm.. Ill take a look at that

msg /listserv

but it's definately not going to be reliable

there is no way to build a realible solution even if i have to ask for users permission in a script to access the system
im not really a scripter I just have the idea

nope

what about using asp? or java?

those are server technologies
nothing to do with a client giving up it's computer name

gotcha…
ill brb

Hi all

hello again, I have a form that I want to submit using AJAX, everything works ok, except that I don't know how to send an array with javascript

Can someone please help me with http://www.alexlibman.com/jstest.html (use firefox). Read explenation therein.

xhr.send(data.makeRequest()+'&attitude='+['salut', 'coucou']);
but it's converted to a string before being sent

array.join (',') ?

Can anyone help me with the best way to implement namespacing?
I have seen two approaches

hey guys, there is a way to know the screen coordinates of an object ? (Relatively to screen)

in the php file ?

yes, sec

Use arrayname.join (sep) in JS, see http://us3.php.net/split for PHP. Make sure the sep string you use cannot appear in data as usual. Don't know if there's a better way, see PHP manual.

this would also work with javascript enabled?
gonna read it anyway
thanks

Alex25NJ ?

sec
Download http://www.alexlibman.com/CieNTi.js let me know if you have questions

what's the simplest way to fill in a form field?

thanks Alex25NJ

how do you mean

i have a form and i want to fill it with "test"

This is relative to browser object, or do you need the entire screen?

just put value="test" for the value attribute
or
with JS

entire screen if is possible Alex25NJ

obj.value = "test";
obj being the input value which could be grabbed it's id with document.getElementById

wow, i just saw a screencast and the dude keep doing function(){…}

for (var i = 0; i document.forms[0].elements.length; ++i) { document.forms[0].elements[i].value = 'test'; }

that is horrible coding
ppl like him should go live with monkeys

do you have a code example?

Can someone please help me with http://www.alexlibman.com/jstest.html (use Firefox, there's no issue with IE). Read explanation therein.

hello, interested in the whole name spacing thing.
Is there a best practice for this?

me too?

does anyone know some good tips on how to get prototype to work well with IE?
IE complains (crashes) when safari & firefox don't

then it's working normally
IE is meant to do that.

IE7 crashes or older version?
Ask the users to use latest version, don't even worry about compatibility with older ones, they're a security risk anyway.

If neccessary to sort of support older IE, you might find it helpful to cut back features
I do this, if I detect that it's ie6, I often cut out certain ajax functionality, effects and such like

IE6 mostly;
that might be the way to go

but I thought prototype mostly behaves
bitwise5, what's giving you problems? anything specific?

ie6 says it's syntax related; "expected :" also "element not defined"

i have a js function, how do i invoke it?

bitwise5 - pastie your code..

see prototype.js (i'm using 1.5.0)

bitwise5, prototype.js behaves well, so my money is that you've got a syntax error. safari and firefox are much more lenient than ie.. Are you using any ie plugins for debugging..
is that your only include? have you isolated it, so there is no other js
not even on the page?
as in no onclicks nothing
this sounds liek aproblem elsewhere I use that version of prototype without probs

yeah, ie6 debugger points to a specific line in each of prototype and scriptaculous;

hello

bitwise5 sounds like soemthing fishy to me. Both those libs are fine. I reckon the error is elsewhere.

need a little help - which properties should I use to change the value of something using javascript in a frameset based page?
I need to update a counter from one frame to another

Are they included in a page with no html other than head body and include js tags
?

i'll have to try that….
i'm guessing they load fine though, the page dies halfway through (well after the includes)…

so you're including only scriptaculous and prototype?

no, i'll try that though; make make a few of the same calls that we do in the other pages

do you have ms script debugger and webdev helper and iedevtoolbar? (sorry if I'm being patronising)
they'llve give you more accurate debugging..

actually, our dev team is on macs so we weren't even test (GASP) ie6 until a few minutes ago

I sometimes get errors in ie which are total bullcrap, and then use webdeve helper and find the real error, whcih is often in another file, or inline (hence me asking you to isolate your scripts)
I'm a mac too
and I did just the same with www.listen2listings.com

yeah, i'm sure the reported error is bs -

went live and then worked out that javsacript in ie has totally different security features and this crappy debugging situation. expect pain for a few hours, my friend
those tool bars will help alot
you can also get firebug for ie
which will let you execute the code snippets live, and that will help you debug
u include it as a javascript on your page.. If you had a page with scriptaculous - prototype and firebug includes
with 1 div
you could try executing some stuff like Effect.Appear('your_div') and shit, to see if it's working (press F12 to display firebug)..

yeah, i was thinking just call everything we use by hand, one by one
that's great advice though, thanks

I suggest build up from that and isolate what IE doesn't like - I guaranttee you've either missed a semicolon, or you're getting an element back from prototype which isn't quite supported in ie. The errors will be bogus, coz of the way protoype uses eval - the problem isn't prototype, so dont;
freak out.. it's something else.
good luck!

thanks!

`icons // Anyone suggest a generic name for icons like these that won't be confused with other uses of that name (ie, 'buttons' is out)

Say it loud, say it proud, say it way too much: http://gtmcknight.com/buttons/validated.php

what's the name of that script that keeps the header and fades in what is below (when you switch page)

Can someone please help me with http://www.alexlibman.com/jstest.html (use Firefox, there's no issue with IE). Read explanation therein.

hi guys, Iam trying to have my text field show available options while typing. any idea? note, iam not a java professional, actually not using it much, but want to use it more in the future

"i am not a java professional" — lesson one: java != javascript

I've heard them referred to as "antipixel" before but that seems to just be named after the blog which popularised them

Yeah, never heard that before .. I'm calling them micro-badges

mmhmmm
widgesigns!

you need to use AJAX for the options.

OK, thanks
thanks

You don't need ajax at all
It's *useful* if you have a great number of options, but it's never *necessary*
;google javascript suggest

and is updated onkeypress

http://www.devarticles.com/c/a/JavaScript/Suggest-As-You-Type/

^^ Alloosh

thank you, I know that the available options are js and ajax, I want to add this as an option to one site iam making and its not so important.

(AJAX is an overused buzzword, I know. But you do need JavaScript.)

(do the same google search for other options)

can I use this to play flv files? var so = new SWFObject(swf, id, width, height, version, background-color [, quality, xiRedirectUrl, redirectUrl, detectKey]);

No one is helping me… Can you recommend a good forum I can take this to?

tips for sorting a table?

http://rick.measham.id.au/paste/tableSort.htm

hi im experiencing an extrange behaviour with a call to an external file with JavaScript code, i have to load two files, the first is loaded but the second doesnt, it wont work if i change the order of loading the files, and i have verified the privileges, the extrange thing is that if i change
the file to web's root, it will load nicely.. my tree is /js -where i intend to store the javascript code., can you help me please?
the code im using is script language="JavaScript" src="js/validator.js"/script

If you edit the location URL for your browser to open your .js file instead of .html, does it come up or do you get an error?

no, it gets the file in text mode

The JS code might be dependent for them to be loaded in certain order, or from a certain place (in head vs in body, etc).

thanks, you indirectly help me to find the issue, it was firefox cache, that was preventing me to load it.. ohh i hate this things!!, i lost like two hours trying to solve this!
thanks a lot, excuse me for the n00b :P
gotta go!, thanks again
lol

I'm in the habit of pressing Ctrl+Shift+R (or Ctrl+F5) to refresh instead of w/o Ctrl - that overrides cache.

damn, saved my png as interleaved, still it won't show while loading
pixelated I mean

how do you make a link on a page be a "back button"
window.history.back()
hrmm.. how do you put that in an anchor tag and make it work.

== eww

help meeeee

Available Plugins: oeis jeval spell cpan shorten rt topic squeeze rbeval acronym change managementspeak reverse join translate bibleit core imdb insult tv help echo eval convert jseval mangle restart quit deparse part pyeval reload_plugins goobooblink heap_test rss

someone help meeeeeeee

hey guys … can someone explain me (if possible) how to fix the delay in the reaction of an IE moving the slide ? (works great on FF). http://www.lachapamecanica.com/nuevo/?seccion=chapastudio
just place the mouse over the slide and it will follow it
but in IE a mouse with sandclock appear and do the slide move slow
and FF does perfect
someone knows how to fix it ?

i'll help you
_IF_.. y
_IF_………….

?
it works
i did the neccesary browser especific things

if you go here http://flyingsoft.phatcode.net/flowers/pictures.htm
and tell me if the images are distorted

taller, yes

goddamn it

i see a left menu, with tall-distorted items

ok, so your problem with IE.
did you just say it works?

yes
try it
it works
but the response time is slower than FF

yeah, i do see an hourglass sometimes

FF works *perfect*
and ie is slow
open it with FF now

How do you get all the methods of an object using introspection in js again?

hmm
for me, ie isn't slow
but it does have an hourglass
are you using ie7?
and I think I might know the problem

" + object[key]);

try replacing 'object' with 'window' for a good time

cienti?

Agamemnus IE6

anyway i had a problem like this before.

tell me please

the little cursor thing is an image?

hum, I've never used console.log actually - mostly alert and div's

is a div background (9×9 px gif)

well then replace console.log with the logging of your choice
I wouldn't do alert, however

yeah i think if you change it to an image it might not be a problem

you'll be sitting there for a while

it's a little tricky because you might break it in mozilla if you fix it in ie6

let's try !

nn all ye brave

i don't exactly remember my solution though but i think it was a div and an image together

" + ok[key]); doesn't give anything though (not a single alertbox even)

I just had a look at the code - i want methods not members

my solution does have a URL, but it's somewhat broken in Mozilla 2.0.0.6 now

what makes you think methods and members are different somehow?

because I'm used to members being variables, methods being functions, the they is used as an arraykey which I guess would retrieve variables but not disclose membernames

"members being variables, methods being functions," yeah most languages are like that. javascript is not

functions are first class variables in javascript

javascript is typeless, a function type is the same as any other type

as george clinton almost said, free your mind and your code will follow

ah right, so it should work then.. strange.

if "loosely typed" is the term, javascript would be the town bicycle on crack

Agamemnus much better .. thanks a lot

" + t1[key]; \n alert(t2);

yes it should
but it doesnt

sure

the date object seems to have no properties, wierd

test it in mozilla too

s/wierd/weird/

if that doesn't work you might want to switch whether it is an image or div background depending on the browser

interesting

What is the best table sorting .js, most compatible and faster ?

sort
its an amazing function

DDustin?

any good IE7 toolbars for debugging and speed loading?

it sorts arrays

but i mean tables
i have a table

Is there some defacto place to look these things up? I keep using searchengines, landing random places. Such a grief compared to some other stuff. I realize there are many companies with their own implementation but..

how to sort it

you don't want to make your own?

welcome to javascript :x

http://rick.measham.id.au/paste/tableSort.htm

(like in my case, the api for the Date class)

probably no

tsb I usulaly use mdc
usually *.. it seems to be the best
for most things

can you believe I've been doing web-stuff for years? for some reason I shun sjavascript.. a lack of any good reference might be part of the reason.
right, thanks.

thanks Woosta

most web devs do
that's the reason I'm making my MMO javascript game

ahah
good grief!

ya. its actually mostly done

WOW Woosta it ownz
:P
Woosta can i use script in body instead of head?
its a php cms

but its to hopefully help prove to everyone that javascript isn't something to be afraid of

so i dont feel like including it in all

I do that all the time

and would suck to check if it has to load the script or not

It's JS, you can do whatever you want with it

DDustin it validates still right?

Anyone knows a little about Ext Js and can help me (although I'm pretty sure it's something I'm missing with javascript)

Woosta love you

I stopped caring about validation years ago :P

i dont, since i get paid for it

I know, it's a much easier language then what I usually use, it's just that is is so wildly inconsistent across browsers and poorly documented and whatnot that it just turns me off. There are plenty of offline-implementations of ecmascript as well

ya cross browser is annoying

but yes validation sux

for hobby projects my rule is I only port to browsers that have proper debuggers

and async javascript didn't exacly make things better
it make for cool possibilities, but compared to sockets and other things it is a nightmare to debug, atleast that's my experience with it
is the game still behind closed dmz's or have you published a beta?

uh ya its public, hold on

Can someone please help me with http://www.alexlibman.com/jstest.html (use Firefox, there's no issue with IE). Read explanation therein.

what was your original question? just looking for docs on Date object?

it was about introspection, I had done it several times before, but had forgotten it I looked Date up on mdc

nfi why js thinks nothing is "in" Date in a for loop

yeah it is public, it looks like I broke it though

instead of doing this manually, are there any editors with intellisense or whatever? I'm sure vim has some omni support for it, but the short description would be good to get as well

let me fix that

Dojo 0.9 is out woo!

http://wipproject.zapto.org/tmp/start.html

I'm guessing konqueror isn't supported?

no sir

works better than opera though
actually, is there supposed to be more than characters there?

as many characters as there are people viewing the page

right

the left control button fires
are you zues?

yeah. it actually seem to work in konq, except for ctrl

here I'll fire a bullet at you and kill you

(but that's because ctrl in konq is an accessibility key which highlights links)

hey … in php you can do a negative comparison just writing ! before ( if(!$var) …) … in JS there is a way to do that ?

hehe neat.. this reminds me of my first allegro efforts

that's funny, you've used allegro?
this script is intended for allegro.cc

if you change direction midair you have to click twice to jump once
haha!
yeah, allegro and then sdl
years ago..

oh
maybe I got it :p

and then sdl/opengl, which is fun but getting graphics for anything but a spaceshooter seemed impossible so it's been a while..
and then sdl/opengl, which is fun but getting graphics for anything but a spaceshooter seemed impossible so it's been a while..

Night all

What's the one-line "if/else" statement look like again (or what is it called?)

omg
i'm running into that problem
there Agamemnus?

what
what do you want

that print issue
http://www.icegn.net/test.html
clic print, print/close are suppose to dissapear
but focus goes back to the window and it redisplays it

the ternary operation, condition ? c1 : c2

thank you SO much!

and it was working fine earlier?

yea, remember, ya tested it
except the code was different

but with style.display=''?

right
remember i had both ways on the screen
resize and style.dispaly

yeah but then we figured out a way to use style.display

but theres something with the html on that specific page that makes it not work

right?
it did work with style.display, right?
with a timer.
you didn't implement it? :/

because a timer doesnt matter
the focus goes back to the page
i could redisplay on a timer, but theres no guarantee when they click print so it could print the buttons

because you need to change your onclick
that's not what I mean
instead of onclick="printWindow(0);"
onclick="start_timer()"
the timer should hide the button then start a 1 second timer that activates printWindow(0)
or less if it works

ok..

do you know how to do that?

yea

ok..
do that and tell me if it works…

dont work
problem is focus seems to be returned after the js function executes
so it redisplays the window
er
button
reload it
i made it alert on focus

show me your code

notice when ya click the button
it popups up and says focus

can you show me your code….

ya
pastebin is slow
hold
http://www.pastebin.ca/666328

The paste 666328 has been copied to http://erxz.com/pb/4131

didn't you forget a 0?

no, was leftover from the resize function

printwindow(0)?
oh, ok

just got rid of it

but wait
you don't need the focus part anymore

how will it redisplay the buttons?

did you try it with the timer and without the focus?
worry about that later

thats all i'm worried about
it hides the buttons and prints fine

so it does work?

yea, that has worked

ok, so now the buttons

the problem is focus gets returned
s it redisplays them

ok ok hold on
why not set a timer on the onfocus?

what'd the timer do?

well, actually…
when does the onfocus activate?
when the button is clicked right?

right after your onclick
yea

ok so you need to set a global var
set a global var when the timer is set
or rathr..
how about this
onfocus, set a var
nono…

well
global it on print
and then onfocus check for it
works

if (var1 == 1) {make buttons visible, set var to 0} else {set var to 1}
you could do that too

the disturbing part

but just put the global var in the onfocus
easier to maintain

it worked on the other test page i did
but not this page

maybe your onfocus action was defined at a different time vis-a-vis your onclick action

http://www.icegn.net/test2.html
check it
its odd

idk,
but your page isn't totally fixed yet
i have an error in IE6…
and ur global var isn't in the onfocus

ya, error is cause it onfocus and printed doesnt exist yet
printed being the global
haha
guess what was causing it to refocus?
right; in the div tag
if i remove it, it doesnt return focus to body onclick
er no
position:absolute;
thats what it was
o_O

thats good to know
and also quite strange

aye

does a mix of position: absolute and float make sense?

heh nope

anyway, going to sleep, nn

the code is so bastardized from where it came from
trying to figure that out

: )

evenin

`dom ref @ Woosta

dom ref: http://w3.org/DOM , http://mozilla.org/docs/dom/domref/ , http://krook.org/jsdom/ , http://www.zvon.org/xxl/DOM2reference/Output/index.html

`ajax ref @ FlashWolf
nothin?
ow
xit
have 2 go

There is no such thing as ajax .. it's a concept

cya plpe

`js ref xmlhttprequest // this may be what you want

The XMLHttpRequest Object specification defines an API that provides scripted client functionality for transferring data between a client and a server. http://www.w3.org/TR/XMLHttpRequest/

sorry…
wht shame…
so long
so long folks
mom is callin me
xD

how do i switch the order of an array ? like i have: [1] = blah [2] = hello [3] = bye have it [1] = bye [2]=hello [3]=hello ?

`js ref splice @ Elagic

js ref splice: Changes the content of an array, adding new elements while removing old elements. (http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:splice)

that is a script?
i want to know how to do it manually

no, it's a command ..

so i can modify this table sort you gave me
to make it list ASC and DESC

note the URL "Core Javascript 1.5 Reference"
Oh, you just want reverse?

yeap
just to reverse them

`js ref reverse //
bah
`js ref reverse

Transposes the elements of an array: the first array element becomes the last and the last becomes the first. (http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:reverse)

ownage
thanks
excelent
Woosta considering the code you gave me, where would you put the tableData.reverse(); ?
i made it i thin
had to change the class of the th to verify if it was asc or dsc
Woosta this has a problem, its doing if th.className == "asc" it wont match if class= someclass anotherclass asc
for example
how to say "if asc is in classname" ?
actually " asc "

if( /\basc\b/.test(foo.className) ){ it's there }

that is a regexp match?

yes

that is the .test for?

that's a method of the Regexp object

wow
weird name for a method
:P
lets try it

A lot faster than the match method of string

kewl
regex rules

\b is a word break .. it will work if you don't try using hyphens in your class names

damn, im spanish, hyphens were?
works very good
oops i found a bug
if asc is in className it makes a .reverse() and sets className to desc

class="foo-bar" will match the regex as two words

but that will lose the rest

you'd have to replace the asc with desc

actually \basc\b with \bdesc\b

foo.className = foo.className.replace(/\basc\b/, 'desc')

exactly
but desc should have \b also right?

No
\b is for matching

oh ok thought it was to match a space

no, it's a zero-width word boundary

ownage
it werks

and i still cant find out how to remove $ and , from matching string … anyhelp ? ;o

vbm, are you there

yup

still having problems?

yes :$

"and i still cant find out how to remove $ and , from matching string … anyhelp ? ;o"
what are you talking about?

$ 1,000,000 ( that's million dollars and i want to have just numbers … 1000000 )

yeah ok
i know A way to do it
It's not the shortest or the most efficient but it's A way
it's a string, right?

yup

(typing)

tnx for your help in advance

"$1,000,000

Error: Error: unterminated string literal at line 0: "$1,000,000

oops

noooo this is mine

"$1,000,000".replace(/\D+/g,'')

1000000

don't say anything
goddrn67d467dn578mfd689,g7.890890,m567

type faster

haha

ignore woosta

i will … he's a bad dude :P

for (i = 0; i mystring.length; i++) {
for (var i = 0; i mystring.length; i++) {

"$1,000,000.99".replace(/\D+/g,'') // I'll leave this one for you to fix though

100000099

"$1,000,000.99.99".replace(/\D+/g,'') // And how do you want to treat this one?

10000009999

;o

no wait.

dont confuse me ;/

let's do this.
and it's always in the form $1,000,000?
that is, the commas and such
no decimals
and nothing silly like $0?
or $000?

there is sometimes $ 0
it's a bank page :]

$ 0?
like "$ 0"?

yup


can you control the entry form?

yes

you need to make the entry form not accept invalid values like "$ 0"
don't allow any keys except $0123456789.
and ,
allow ,

$ and , is not allowed

strip out the ",", we don't care if it's in the wrong position
then it's not really a problem is it
lolz
ok don't allow anything except "0123456789."
do you know how to do this?

well … if i knew i wouldnt ask :P

oh and one more thing
you don't want a hacker to crash the system
so you need to do client side checking later
i mean..
server side checking
you can't trust input that you get from the form

it's for greasemonkey script … and it's for web game i'm playing ;d

a bank?
in a game?

yup

you're programming a bank in a game? what?
…..
?

im trying to create "withdraw money" button

As opposed to withdrawing it some other clumsy way

click on amount that is visible in td … remove $ and , and fill in the form
more or less

but the website that you don't control receives the data?
um… anyway… someform.onkey() should not allow the $ and ,

Comments

i want to just get the raw exact data from the post and then use it if i am going to use it in a mysql query i

mattmcc, right, but nothing in program files is in my path

it's a posix layer, so of course it's not going to let you execute cmd.exe commands unless you explicitly run that shell

err… not really running on unix

caffinated, i meant more like progams, nut builtins for cmd.exe
i installed mplayer for windows and couldn't run it from my bash shell
piss on that.

you would have to cd into the place it is instelled to.

fireflymantis, yeah, and thats jus tnot ok with me. because the place its installed to is too far away.

why you'd want to use mplayer is beyond me .. windows already does media fairly well.

whoever came up with the name "Program Files" should be shot
caffinated, i'm addicted to mplayer. I hate every other media player

progra~1

shudder

lol. yeah i hate that more than the full name

It's VLC and winamp for me when it comes media on wndows

yay totem.

Cool, that only took 9 minutes.

hey, nice
chanserv++

VLC is okay, but it never shows up on the right screen (I use tv-out_) and it gets all buggy when you try to open a file and the play is already open. you ahve to drag it between screens and resize it.
plus no other media player has the keyboard controls that mplayer does

Does anyone see something wrong with this code? http://pastebin.osuosl.org/2045

Attempting to use an array as a scalar?

bkero, you need to lose the $ before stuff un 4this-stuff

if ($thing) array_push($this-$stuff,$thing); should be if ($thing) array_push($this-stuff,$thing);

should be $this-stuff

o, so no second $

right

3

Syntactically valid, but not likely what you intended.

Danke

with the $ would be a variable variable reference

i didn't know that would work.,

does anyone have strong mod_rewrite-fu? I'm after a rule to translate /* to /vfs/* - assuming of course that it's not already /vfs/..

is anyone good with php/openssl bindings?

fireflymantis, is that how simplexml does those dynamic properties?

so if $foo == 'bar' then $this-$foo == $this-bar

actually i think that kind of works in the opposite way

Is there a way to make PHP not store large ints as X.XXXXXXXX EXX ?

http://ca3.php.net/bc

Hahah.

http://pear.php.net/package/Math_BigInteger

what is this php webhosting thing for? fb?

Euler Project

Is there anyway I can use a variable to declare a variable name? like: $_POST['q'.$i] ?

hmm

$$?
i think thatll do it

hm

when you have is correct.

Xinil, that example you posted should work too

/s/when/what

what do you know about creating a mailserver?

Some
PM Me about it though.. this isn't the channel :p

well I am going to have questions about its operation with php anyway

ok…

ah, $key did work
dunno why, just thought it wouldn't work for sure

because when I validate someone and make them able to log into the site, it is supposed to send them an email allowing them to do so

Xinil, your example looks to me like it would obviously work, but php is capable of more surprising things than that for dynamic variable names.

Is there a mail server running already?

it lets them know they have been accepted on the team
mailserver? naw
not yet

WOOT Works great

thanks andre_pl

DARKGirl.. linux or windows?

OSX (Unix)

Uhh… lol
No idea

haha
its just the same as Linux, silly

if you're banning those mass join/quits they're just bots heheh

Its unix based, but the same applications won't run on it
DARKGirl, look into the PHP mail function
Should work fine though

sure they will

OSX (Unix) Lol. I wonder how much we're going to see OSX being called unix host now that its got the seal of approval. not that anything actually changed.

csc`: yep, they're bots which won't join/quit after i'm done

lals

what if those ip's are stolen from others :

It's just a perl script connected to a pool or tor proxies
so you're banning legitimated users from your channel
np

you just have to compile whatever application for OSX than Linux

Aww
Opps wrong indow
window
Having fun?

heh… so aqua data studio works, but it still doesn't solve the problem that I'm connecting to an mssql server to get data dumps…

Notice how everything starts with either "88" or "85" ?

wietz0r, you can't ban a whole subnet though :p

goddammit just blanket ban tor from the channel

hi

hi brenden

I have to Logins screens on my App, one is for admins, and the other one is for customers, when an admin logout of the app the customer session getlost…. anyone can help me??
is two, not "to"

omp arent you ruby

csc`: yeh

do if(array_key_exists($key, $array)) {} and if (isset($array[$key])) {} do the same thing?

NemesisD they are very similar, I would double check on the case of an initialized key pointing to a null value, because that should return true for array_key_exists, but it might return false for isset($array[$key])

hey there

hi guys i'm trying to learn how to hack php

ok chewy, i think ill go with isset in that case then
hack();

k

yeah thats what I would do

have an embarassing question
re logical operators in php i'm used to seeing && when doing a logical AND statement

was php made for people who can't understand perl?

however in Drupal I'm seeing a lot of & instead of &&
is there a difference?

&& is logical AND || is logical OR, & is bitwise AND, | is bitwise OR

not especially. an alternative, yes.

ahh bitwise that would explain it!
thanks chewy one of the items is indeed bitwise

why use perl if yyou dont have to… sure I can understand it, but that doesn't mean I want to deal with it.

eh.. perl is fun

perl IMHO

in fact, a lot of people in here can write perl, and just choose not to.

for web scripting definitely
btully np

NemesisD, I agree… i wont doubt the power of perl, but its just too nasty to look at.

perl is a lot more fun that php for one liners

yeah, if thats your idea of fun.

i prefer video games for my fun :P

'one liners' are generally not realistic.

well I do a lot of php -r one liners
and perl would make a lot of that easier

what about in an if statement you need to see if 3 things are true/set and only one is a bit

but then I would be writing perl code to generate php code and thats just too much of a head ache

if one of your goals when you code is to make things readable without 10 lines of comments, the 'one-liner' is usually not a good idea.

if ($foo && $bar && ($num & 32))
caffinated well I just use one liners for code generation, so its more of just quick hacks than never get looked at again

fair enough.

lets bash asp.net instead. I just found out that's one of my classes this year, and theres no php at all

ouch that sucks

if ($item['type'] & MENU_VISIBLE_IN_BREADCRUMB && $item['path'] && _menu_item_is_accessible($mid)
) {
does that make sense?

i think its ridiculous. I understand forcing us to use .net for general desktop programming, because they want to make people know whats going to be used mainly in the workplace… but lets face it, ASP.net is a HUGE minority on the internet.
not giving them php experience is shooting them in the foot.

MENU_VISIBLE_IN_BREADCRUMB is the bit
the rest are either true or false

that looks alright, I would put parenthesis around the bitwise and

eh, any programmer should be able to pick up at least rudimentary php in a week or two.

but that seems fine

it's hardly complicated as far as languages go.

caffinated, yeah but in school, most of the people in my classes are idiots who need to be spoon-fed everything.

and they're the ones who will fail.

if they dont learn it in school, they wont learn it.

you mean if ($item['type'] & (MENU_VISIBLE_IN_BREADCRUMB) && $item['path'] && _menu_item_is_accessible($mid)

yeah php is pretty quick to learn because it lets you do whatever the hell you want, haha

?

you don't need to be concerned about them though. you only need to be concerned with you.

caffinated, i wish that was the case. but no. my school sucks and everyones stupid.

naw I mean if ( ($item['type'] & MENU_VISIBLE_IN_BREADCRUMB) && $item['path']…

ahhh i see
thanks!
and if i need to add another item that is bit but i need to check that it is not set?

that way you're sure its doing bitwise and comparing item['type'] and MENU_VISIBLE_IN_BREADCRUMBS, rather than bitwise and between item['path'] and (MENU_ITEM_IS_ACCESSIBLE && item['path'])

just out of curiosity, for anyone who is in post-secondary school in the US, what are your computer courses like?

$item['type'] & MENU_VISIBLE_IN_BREADCRUMB ~ MENU_LOCAL_TASK)
?

I always forget the precedence tables so I like to make sure its not an issue
andre_pl absolute crap
I dropped out of comp sci and I just work full time now

Is there in PHP anything similar to "friend" keyword from C++?

btully you can add && !isset(NEW_BIT_ELEMENT)

nice

JaBoJa is friend similar to protected, or is more of a casual relationship

thanks SO much!

I have a php script that generates text files from a mysql database. The files are probably 20-60 kb in size each and about 5-15 files at a time. When this script is running, although only a few seconds, I cannot execute other php script on the server simultaneously?

yeah np

it blocks other requests and it shouldn't. the server is fast enough and with 4 gb ram…

Crytor well if you're doing a db dump then the db is locked

it allows to access protected members from methods of another class

chewy, I'm in college in canada and i'm pretty confident that i'm not going to learn a thing until at LEAST my last year.

check http://dev.mysql.com/doc/refman/5.0/en/table-locking.html

well, SELECT queries and file_put_contents - on selected fields from database. not a total dump

andre_pl ya know, I thought that too, then I started getting into the more advanced classes and it was just letdown after letdown

aha

I had an operating systems class where we did a fucking play for the dining philosphers problem

LOL

Crytor well as long as you're not locking the db, and you're on a multiuser os then you should be fine

chewy, my OS class was using VMWare to install windows, then we learned about some of the advanced control panel things, then we install sisoft sandra to inspect our hardware.
that was it

wow that sucks

MUTEX EXIT STAGE RIGHT
I'd love to see the script for that play.

chewy Totally. 10 assignments, every one of them was "Create a power point presentation with screenshots from your VM. showing the following 10 screens"

mattmcc lol

I think mysql locks the table anyway per default

andre_pl ahhh that sucks, we got to do a final project where we analyzed the VM of an os, so I did it on unix version 6.0, using my lion's book, so that was pretty cool, but there wasn't anything in the class I couldn't have done more effeciently and had a lot more fun, doing it outside of
class

Crytor you might be right, but I didn't think it locked it for selects

chewy, in my java class, we were supposed to be using linux hosting (just to give us a taste) but my teacher put it off ALL Year (i assume because he didn't know how to use it) and then he ended up just giving us a bonus 5% if we demonstrated hello world
running under linux.

LOL

the issue is that lets say you have long running query A. then along comes a update B. then there is another select C. B has to wait for A. and C won;t run if there are waiting updates (b)
(where A is a select of course_
)

I used linux all year for everything

but won't those queries be queued?

yes

but also I thought he said he was just doing a series of select statements
that should just take a min longer if hes doing selects and updates, but it shouldn't lock him out completely

with MyISAM, it often does

if A is a select and B is an update why would B have to wait for A to finish?

heh… time for some regex fun… gotta take an mssql create database dump and then convert it to mysql

because otherwide A's select could be corrupted

andre_pl because you can't have the update modifying rows while the select statement is running
caffinated see thats something I would probably write a one liner for, going from mssql to mysql

INNODB has row-level locking, and might solve your problem Crytor at the expense of a small loss in speed.

well I might make that an actual script in case I need to run that again, but that would be a fun one liner

erm, i would use an adapter pattern

does anyone know how to dynamically create div tags based on a list?

What type of list?

How about a loop?

well, i am supposed to read from a mysql database hosting a list of users that have asked to gain authorisation to log in
this is an administor-apprroved site
you cant just sign up with a username and password and expect to log in right there

foreach($users_needing_auth as $user) {echo "div$user/div"};
like that?

ah an echo?
facinating

yeah, that's kind of complex

well you could just kep adding to a string and then send it out all at once.
complex?
how so?

he's being sarcastic.

oh, lol

Nah, just echo it as you get it

well I will need some special stuff. I will need a checkbox to be added next to a userid to show what settings the users have on their accounts

DARKGirl, you can add all of that inside the loop

that is so cool

lol, pretty basic stuff.

I didnt realise echo was that powerful

its not echo.
its the foreach
echo just prints things

ah, I am familliar with foreach
ask Thecks

Nooo!
I am not an oracle

yes, you don't even support views

nonsense, youre a PB programmer just as I am

PB?

I don't support views? :o

Oracle does

aye, but its supposed to load all of the users in the database

I'm learning Zend framework… that uses the view model
I meant An Oracle… that mystic thing you go to for advice :P
PB = Pure Basic

i'm just being an ass. don't sweat it.

its a user managment system. it allows me to easily remove/modify users without having to resort to the damn console

http://www.evolt.org/article/Storing_form_array_data_to_MySQL_using_PHP/18/60222/
Take a look at that, it shows how to load all the data from MySQL into an array
And cycle through and output it

aye! thats something of what I was talking about!

Its more … untidy than the foreach example

its going to be a makeshift table though

But you get the idea

not a real one
just something I made myself

well, you can also do it directly in the result set loop

I do understsand the concept now, yes

it really depends on your code logic

DARKGirl, http://pastebin.ca/669698

pastebin is a nono
lol

why?

http://rafb.net/paste/
use that
because its slow
VERRY slow

i'm not gonna re-paste it.

eh, pastebin is fine. you're right, we were encouraging people to use other things in the past, but that's because it was taking like 3 minutes to render the page

it was just a simple example

i wont be able to see it then

its fine for me. not slow at all

improvements have been made since then

DARKGirl, it loads fine.

I tried it
its still loading
it almost never works for me

thats messed up. never had a problem here.

fast for me as well
it must be a netowrk problem

i was going to copy it to rafb but when I copied from pastebin it numbered the lines and made a mess of it.
don't feel like cleaning it up

ah good, you use mysql_fetch_assoc()

caffinated, imho only a moron wouldn't.

"Safari can't find the server."

who wants to refer to column names by a #?

i don't have to use my ##php user vodoo doll

yeah, I can never connect to that
it keeps timing out

caffinated well an adapter pattern would work, but then I would have to make that, and thats a little more complicated than I'm looking for, for two reasons, 1) This is just a table dump, so there is only 3 regex I need to parse the whole thing, and 2) if I made an adapter pattern that would
imply that I'm expecting to run into this again, and I really don't ever want to do this again

what can i say, i'm a sucker for punishment

haha
well at least I'm going to do this in a script rather than a one liner, I'm not trying to punish myself that much on a friday

someone in the community channel was making some joke about someone eating something, and representing it as object/method calls. I fixed the composition. :P

lol

caffinated, sounds like my C++ final project.

well, a lot of people here don't really understand object relationships too well.
which is fine i suppose, considering php's procedural nature

caffinated, strangely enough, when I started lto learn about OOP in java, i found it easier to apply the concepts to php than to java.

haha yeah because objects in java hosting are just annoying

likely because java is very strict.
php really allows you to get away with a lot. some would argue too much.

yeah I think php is too loose

I'll never agree to that. the looser the better!

But, that's what we've got ruby & python for.

eh… a loose language is nice, but its annoying when you don't have variable checking so typos create interesting little bugs
of course its nice being able to declare and increment a count variable inside of loops and conditionals

chewy, that's so rare though, I almost never mistype a variable name, and its just not worth all the hassle.

if that made any sense

yeah it did

well I would just like use strict for php
haha

chewy, I think theres something you can pass to error_reporting that's supposed to indicate possible misspelled variables.

in php5 oo you can force methods to accept only objects of a certain class

E_NOTICE

thats it

which is some kind of exception to the loosiness

Cahaan, I didn't know that, but I can't see how I would ever use it.

mm .. loosiness

Colbert-style programming.
Boolean operators that determine truthiness..

yes. it has an exceptional truthiness quality

well I don't use many objects, but I would like to at least have my variables checked that they have been declared

lol

That's great until you want to type hint a string or int.

hey is there some way i can use php to change my current link in my navbar?

yeah you should then create your own classes to encapsulate string, and int
byeah you should then create your own classes to encapsulate string, and int/b
which starts to be annoying

And eventually you'll have a nice Java class hierarchy…
Oh, wait, Zend's already working on that.

if i had a stick, i would poke you with it

see you click on the different links but it doesn't change because its reloading the new page in the middle iframe
carlolorenzetti.com

I don't mind

lol

eh, I would rather have ruby style objects that just allow you to add methods on the fly to predefined classes, than be able to make wrapper classes for primitives

class String { } … that is a little overboard i think

lol

Yeah, then you get a few third party libraries into the mix, and pretty soon you don't have the foggiest idea how a string behaves…

well it exists in Java, in C++, and a lot of other languages

well, yes, but it's a part of the standard library

sure it is

AND Those are "Strongly typed languages" php is not, and shouldn't be

mattmcc well I don't remember exactly how ruby does it, but I'm pretty sure you could keep the changes in the third party library isolated

that wouldn't be. worse, it would be in userland code

I agree andre_pl
I'm not trying to argue actually

Monkeypatching gives me the willies.
I don't know how ruby folks can like it so much.

so it is possible to do yes?

they are all crazy macbook users
and they like danger
method_missing magic really angers me some times. people abuse the hell out of it.

My Dad wants a MacBook for his next laptop. :P

clos, you're not making much sense. php can probably help you, but you need to know more than just that you want your links to change

tell him it's a trap.

I like it because then you don't have to makes functions to act on passed in values, but rather functions to operate on values
caffinated lol

andre i'm just starting to learn php and i think i need to echo back some html somehow

I find it a non-coincidence that he started thinking about getting one around the same time he started poking with Rails.

do you think OO in php webhosting can be interesting for some projects ?

if you go to the site you'll see what i mean

I've got a macbook and I love ruby, and my good buddy who is a ruby hacker also has a macbook

it's sort of hive-mind mentality i think.

i just need to change the current link

Silly humans.
Sorta like how everybody has a webcast now.

clos, if its loading in an iframe like that, then you probably need to use css & javascript to change it

Cahaan not really, because you're limited by the lack of state, however there is a pretty good book on design patterns in php 5, and you can do some cool stuff, but you are significantly limited in the useful of design patterns compared to most languages

After all, how are people supposed to learn about your software if they can't watch a movie?!

write a mac virus, and set it loose on the conference wifi.

that's right

We already know nobody reads documentation..

yeah i fugured i could do it with javascript, but i don't want to
i fugures i could do it with php

clos php can only change a page when it is refreshed. that page never refreshes

i see

well, the quality of most documentation is very poor until said project reaches a certain mass of followers.
most people don't like to write documentation. even fewer are good at it.

and since OO seems to change with every new version of PHP, I would think twice before using this paradigm

and then once you get the mass of followers you get the comment system that is php.net

Django's docs are pretty good, I'd say. However they made (imho) a critical error in making the default docs apply to the dev version, rather than the latest release.
Case in point, http://www.djangoproject.com/documentation/tutorial01/

caffinated psssh… write documentation? shiet I don't even like writing comments

my comments are usually commented-out echo's

A couple weeks ago, 'max_length' in trunk used to be maxlength (As it was in all released versions to date). It was changed for consistency, and to avoid confusion with the HTML attribute.

that's the ruby attitude too - if you need a comment, your code is too complicated.

Now, at the top of every docu page, it says "This document is for Django's SVN release" with links to the docs for the last two releases.

as a result, there is a lot of poorly documented "magic" ruby.

And yet when max_length was renamed, we literally got a dozen bug reports about it.

caffinated haha yeah seriously, ruby is all about breaking things down into so many small cases that if you try to comment it, you will more than double the code for thank chunk

"Your docs are wrong!"

hah

*for that chunk
wow I'm having issues typing today

well, it's good until you understand how much the community loves to metaprogram

it's quite fun to write documentation

its friday and I'm ready for the weekend, but I'm going to be here at work all day tomorrow

then simple-to-understand things become simple-to-understand-for-the-initiated

tools like doxygen can make it even more fun

caffinated yeah they tried to avoid doing shortcuts like perl so that it didn't have the initiation overhead

as with all languages though, the core group doesn't give a rats ass if you understand it or not
i hear it a lot at the conferences that people are afraid ruby will be "overrun by php users"

haha yeap, and they shouldn't beyond an extent, I mean they're the people who are using the language constantly, so they have the best idea of what it does and does not make sense to turn into shortcuts
caffinated haha yeah I could see that, because ruby on rails lets you knock out a lot of code very effeciently once you're used to it
so as ruby becomes more widely available I'm sure a lot of php users will switch over

well, also, if you go from rubyconf to railsconf, people at rubyconf have a disdain for the people at railsconf .. even though it's a lot of the same speakers
some hardcore eliltism there

caffinated really? I didn't realize there was hostility in the ruby community like that, as powerful as ruby on rails is I would have thought the ruby people would be all over it
"hey cool I can knock out badass MVC websites using ruby code.. sweet!"

well, people at rubyconf are interested in the language, and some see rails as a gateway to let idiots in.

I don't see why they wouldn't like having that tied into their language
caffinated well anytime a language gets to the point that you have really cool features that can be easily used, you get a certain amount of hype from people who actually know how to use it and love it, so then you get a lot of idiots switching over
thats just part of the internet tho, eventually you can't hold the idiots back

oh, it's just like linux power users wanting to keep linux complicated so the newbies don't pick it up.
it's kind of sad, actually

Every tier of society has to have another tier to look down on, to feel better about themselves.

what is a registered, but unused domain name worth? like if i want to make an offer on it?

person Y want item X to be popular enough that you can do it as your job, fulltime. but in the same token they don't want it so popular that idiots use it. however, that sort of adoption is in person Y's _best interest_

caffinated haha well I do agree with that to a certain extent, to be honest I don't really like the current state of linux distros, ubuntu rocks and has a lot of cool features, but its become bloated and unreliable, I'm not much of a fan of suse or redhat or mandrake, slack is cool but I would
rather just run freebsd, and my old distro of choice, debian, has been overshadowed by ubuntu, so there isn't really a distro I like that much right now

right. which is why there will be another one some time in the future to further add to the confusion.

I love fluxbox, and I played around with getting fluxbox working with ubuntu, but all of the cool ubuntu apps require tons of gnome or kde libraries, defeating the purpose of having a lightweight WM like fluxbox

i hate how fragmented linux is.

caffinated, it hates you too.

well, distros are i should say

:P

caffinated yeah no kidding, its becoming a serious issue

no its not.

distros? they sure are.

theres like 4 different MAIN Distros. and they're similar enough

to be honest, I've switched over to OSX with my macbook, and I use freebsd/openbsd for my servers now

hi aain

i swear, i've screwed up so many times on this batch i probably couldve done it manually by now

andre_pl they don't have many similarities, they all have different package management systems, they have different directory trees, they have different base applications, etc etc. Linux distros are getting farther and farther apart rather than becoming more standardized

similar enough to you.

extracting all images from a dll, renaming them in order, removing every 4 starting from 2, renaming them to (style)(color) then converting to transparent png

if they were "similar enough" i should just be able to install a package on any machine with minimal hassle using any packaging format i like.

what would you name a variable that stores either 'ASC' or 'DESC'?

caffinated, i can install rpms on debian, thats good enough for me
`cb, $sort_order

yeah, good enough for you

yeah but installing rpms on debian just makes me want to stab myself in the eye
I hate rpms, they are evil

order… hmmm
good enough

downloading and installing .exe's is worse. who wants to click through all that crap… and then having to google for your software and downloading it fro a wbe page.
thats so old shcool

to be honest I would rather download and install an exe than an rpm

ever use apt-get or yum ?

because at least the exe comes with everything it needs, shit rpms are just a trail of installing random rpms

apt-get install [package]
gg

yeah i'm not going to argue that rpms are total crap.

I love apt-get, I try to avoid yum as its slow and fills my screen up with downloaded header messages

they're terrible, but i'd still rather just have to type one or 2 commands to install something hten google, download, unzip etc.

`cb I'm just saying I hate rpms, you should use a package management system
but overall my favorite package management system is freebsd's ports tree

yeaaah, im not really interested in compiling and whatnot

I really liked gentoo
's portage
just got sick of compule times.

mac spoiled me D:

I have an array with a bunch of ID's in it. Is there a way I can run a query with the WHERE statement matching *ANY* of the ID's within that array?

¿?
lols

IN ()

`cb I like it for servers because then you are always right there to change the make files to what you need

implode to a comma sep string first

SELECT * FROM table_name WHERE id IN(2,4,5,,8,12,43);
err, ignore the double comma above

oh! nice… thanks guys :-)

after the intel switch I love apple, my macbook is by far my favorite laptop I have ever used

exactly

Anybody know of any places that you can submit your database structure too and a database architect will take a look and give their feedback?

Is there a way to pull data from a pdf with a php script

yeah right here, but I charge $50 an hour

depends on the PDF

And I love my Vaio's keyboard that people keep thinking was an Apple thing, when Apple really just lifted the idea from the Vaio X505.

$50/hr is all?

chewy.. I'd be willing to pay that

`cb, What am I looking at for issues? What matters?

As long as you can guarentee it won't exceed X amount of hours

takes balls to buy a sony product now-a-days

run your queries with EXPLAIN too. helps you optimize the,
..the structure a bit

In PHP regexps, escaping just a space (and not any whitespace as with \s) is just backslash space, right?

Thecks well the amount of time it takes is completely dependent on the complexity of your db, but I can give you a rough estimate

`cb: Oh, hell no. I'll never buy a different brand laptop. My first Vaio lasted 5 years, I beat the crap out of it. Second one survived two liquid attacks before finally giving in.

Anyone use PHPGTK here?

`cb: They does not screw around when they build a solid product.

http://www.devshed.com/c/a/MySQL/MySQL-Optimization-part-1/2/

all i know is the last few dvd players, tvs, and other assorted stuff have been pretty crappy

i use it quite abit, but not enough to be able to help anyone

mattmcc, I believe they're one of the few companies that actually have a laptop factory too

`cb: Ah, yeah. That stuff is virtually a different company.

Can I specify character set for file functions (like require, fopen). I mean the charset that is used to encode file names, not the content. I ask because I've problem with filenames with non-ASCII letters (I use UTF-8 in my script, but filenames are [probably] encoded in windows
encoding).

Just play around with it or?

nah, just my apps end up sucking :P

craigbass1976 I had a buddy who parsed pdfs using ruby and he was able to get a text dump and regex the data out of pdfs that were locked, I don't remember what he was using to get the data out of the pdfs tho

Indeed. Gateways and HPs are all outsourced, iirc, along with most Dells.

All dells

:P, I was just wondering if it would be worth learning and playing around with it. Obviously I wouldn't be building any large scale app with it :-p

I was amused a couple years ago when Gateway & Dell had a line of laptop that were completely identical.

they might throw hard drives and more ram, but they dont' make anything

yeah, but it's 5mb and open source if you want to distribute it

These days they try harder to have slightly different offerings, so that you can't make apples-apples comparisons.

does anyone have a function that will strip all special characters from a variable?

ahh

because magic quotes is broken
the thing is

I probably won't learn it, most likely end up learning C++ or Python.

I only want/need letters and numbers from any input from the user anyway

special characters for HTML or for insertion into a SQL query or wat

DARKGirl, html_strip_special_chars I think

mattmcc, http://gen-x-pc.com/laptopmanu.htm
there is also a chart somewhere I saw of who buys from who

…are you sure that function is not broken?
because they told me that I would be better writing my own

html_strip_special_chars() is non-existant

right now I use "mysql_real_escape_string"
but they said that is not fool-proof

Damn/.

mysqL_real_escape_string is fine, so long as you check for magic_quotes first
otherwise you can get some nasty things like \\\\\\\\\\\\\\\\\\\\\\\\' appearing in your content

Heh
are you doing something like user registration?

thats right

and you awnt to restrict to like alphanumeric?

are there any special characters that are not dangerous?

ah… if you only want to allow certain characters, validate against regex
for passwords, just hash, and allow whatever characters they want

ctype_alnum checks for alphanumeric, returns true if yes, returns false if special characters.
http://us2.php.net/manual/en/function.ctype-alnum.php

oh, I dont strip the passwords, because they are immediately MD5'd

PHP-WTF: http://rafb.net/p/YDiIVc43.html

nice !

holy crap

heh that function is not really helpful because I am looking for something to strip the chars, not just check if something is there

oh ok. sorry.

please tell me what's wrong with this code? http://pastebin.ca/669727

DARKGirl what chars are you trying to strip?

if you strip, and do not warn, they will not be able to log in

its should be returning "img there" because the $_SESSION['profimg'] session is set

and you will be accused of releasing a broken product D:

`cb: haha, fnny

it's set to show img there if the session is NOT set.

well I am stripping any user input fields before I actually process them

stripping them of what?

doh! thanks

:P

that said, usernames can only be alpha-numeric

how can you validate them if you strip them beforehand?

what about preg_replace(array('a','b','c','etc'),array('','','','',''), $input)

How to get know which encoding filenames are in?

also, not sure if your a fan but, check out 'Terany Operator'.

never heard of it

= ? : ;
3

`cb: how? well they are not allowed to create usernames with special characters anyway

ternary yay!

yeah ternary operators are good times

so, if they try to create one, make it fail validation, so they can change it

except php is kind of weird when dealing with nested ternary operators

http://us2.php.net/operators.comparison

don't change it for them

do you mean ternary?

Magic quotes is not dependable and many shared hosting servers do not allow users to use ini_set

sorry, thought that's what i put :-p

i don't nest ternary in php

what does it do?

`cb: that is already in place

`cb yeah neither do I, I always have issues with it

i try not to nest ternary in anything really
so whats the problem?

http://us2.php.net/operators.comparison Check out the heading Ternary Operator

thanks

i was just wondering if thats all I needed

I like to use them in sprintfs when you don't want several levels of if statements

Im having real trouble with conditional tags, anyone see anything which looks wrong? http://www.nomorepasting.com/getpaste.php?pasteid=2985

does a session end when you close your browser window?

It usually does
you can specify the settings in php.ini
or using the session functions in php

by default I mean

default is kinda vague, depends on your distro's default settings
butt, usually yes

hehe you said butt

hehe

It was meant more of a but….
should have used …

distro?

butt distro… I like it!!!

distro refers to your distribution of linux. Many distributions come with php bundled by default and have their own settings
depends

hmmm
’cause I'm setting a session variable in a page that I haven't gone to yet, but its showing that variable form the previous session I was in
how do I delete a session variable then?

unset
the variable

it would be easier if it deleted when I closed my browser window….

wouldn't it?
so, set it

can I do that?

yes

go on…

you can do anything you put your mind to

lol

use google man
come on
why do I have to spoonfeed you
just google php + setting session properties
something along those lines

that is the purpose of a session
it carries over to pages you haven't gone to yet
if you have previous sessions, perhaps a call to session_destroy() might help you

thanks

closing the window won't do anything, you need to quit the browser

want to empty your session data, simply perform $_SESSION = array ();

yeah, also what sean` said

thanks

hmmm… anyone see why preg_match('/^CREATE TABLE (\[dbo\]\.)?\[([A-Za-z]+)\] \(/', $line, $matches) isn't matching CREATE TABLE [dbo].[CC] (

`cb, what if it's the last window of the browser :p

so if someone forgets to logout, it will clear the date

swimrr, if you forget to remove the session data, it will stay as long as its ment to be there

its failing on the [dbo].

sean`: if you are using Winblows, it quits
but not on mac

`cb, I stand corrected :p 50% at least :P

I can match create tables with the [dbo]. but I'm failing on any that have it

swimrr, assuming there isn't anything else that interferes, like emptying the local cookie data

hmmm

sorry it matches any without [dbo]. but it fails with them

eh

any ideas?

my regex method is the 'trial and error' method

hmmm - right now, if I log in as one user…then go to the site again, log in as user2 - it keeps some of the session data from user1

you aren't cleaning sessions on logout?
are you using cookies or session saving extensions / addons?

'cb - that's just it, what if they don't logout?
they just leave it there?
you know how users can be

session eventually timeout

oh….
okay

ok this is starting to irritate me, any ideas on this guys?

how long?

hmmm… anyone see why preg_match('/^CREATE TABLE (\[dbo\]\.)?\[([A-Za-z]+)\] \(/', $line, $matches) isn't matching CREATE TABLE [dbo].[CC] (

variable, depending upon server
you can set in php.ini iirc

thanks

or more specifically why (\[dbo\]\.) doesn't match [dbo].

it should match just fine

hehe yeah thats what I thought too, but I've got empirical evidence to the contrary

you've peaked my interest

Check your variable I guess.

piqued

I can match CREATE TABLEs without the [dbo]. but it fails on any that have it

chewy, whats up

why are you regex'ing on that string?

http://pastebin.ca/669748 - when I ran that on my localhost, it echo'd true.

I'm trying to use preg_match('/^CREATE TABLE (\[dbo\]\.)?\[([A-Za-z]+)\] \(/', $line, $matches)

why?

CREATE TABLE [dbo].[CC]

chewy, strpos ('create table [dbo]', $string)

JymmmEMC because I'm trying to write a converter from mssql create table sql files to mysql

oh, duh

sean` well the regex matches any create tables that don't have the [dbo]. in them

chewy, so.. your point?
You're telling me you can't achieve this with strpos?
strpos ($string, 'create table [dbo]') * mixed them up

I'm sure there is a lot of ways to do it, but a regex works just fine as long as I figure out whatever syntax error is there

chewy, it doesn't seem to work.. so why don't you go for the approach that will work 100%?

lol

silly

sometimes I wish PHP/RegEx were explosives…. one lil mistake and no more problems.

chewy, I'm not saying you should not investigate the error i fyou're interested, but why let it stop your work.. continue with your work and think about it some other day, maybe when your mind's a bit more clear

well first off, I like regex more than strpos, second off its more convenient, 3rd off it should work 100% of the time

lol @ jymmy

because I need this working right now

what Sean said

heh

then use string functions
try your hand at regex when you have learned how
!+mre

http://www.weitz.de/regex-coach/, or http://www.ilovejackdaniels.com/regular_expressions_cheat_sheet.png

heres the thing, I don't want to rewrite this using somethign less useful and less convenient because theres a stupid syntax error, thats a lame way of quiting

chewy, so.. I like a 100$ bill more than a 50$, but if you hand me 2 50's I'm not gonna say no cause they aren't 100's

hahahaha yeah you're right I don't know any regex
I think you don't know any regex if you're idea to fix that is to stop using regex and automatically assume I'm some random noob who knows nothing about regex

So you want to TRUST something that you are not 100% proficiant with?

yes as a matter of fact I do

chewy, we aren't assuming you're some random noob, nor are we assuming you don't know regex (however you just told us)

http://dev.ngisedesign.com/test.phps
chewy:

because I write regex all the time, and I would say I'm at least 72% regex proficient

We're just giving you a feasable and easy to integrate solution


FIGHT

Usaing regex as a "cure all" is not the right approach, lots of overhead, use the right tool for the job,no more, no less.

chewy, is your ego that big, that us helping you upsets you?

chewy, i think you are high, cuz it works fine on my box

I'm not looking for an alternative solution, I'm looking to know why the fuck (\[dbo\]\.) doesn't match [dbo]

chewy, watch the language -.-
Anyway, good luck, I've got better things to do

then stop trying to tell me I'm a noob regex tool trying to use a grenade to blow my foot off because I have a subtle error in my regex
this is a rather simple regex that isn't working

chewy, stop saying stuff that hasn't been said

if it was a subtle error and you know what you're doing, then why have you asked repeatly in here?

because I am not subtle today, I'm exhausted, overworked and I have to work tomorrow on my day off
you want to see some fun regex? :%s/\($this-\([a-z]\+\)Values.*\)\@=\($indexed\[[0-9]\+\]\) \/\*\([a-zA-Z0-9_]\+\*\)\*\//$this-getFeats(\3, '\4', '\2') \/*\4*\//g thats some vim regex I wrote this week

and your point is?

haha

DAMN, you've really got some issues

chewy use www.regexpal.com

http://dev.ngisedesign.com/test.php // http://dev.ngisedesign.com/test.phps

it's a great tool and helps with testing

nothing wrong w/ that regex

JymmmEMC I've already made my point, and my point being it doesn't work, but we're way past that now

There are more ways to rome, remember that

Does anyone see why this is returning 0? http://pasteosaurus.com/415

!+doesn't work

Look buddy, doesn't work is a strong statement. Does it sit on the couch all day? Does it want more money? Is it on IRC all the time? Please be specific! Examples of what doesn't work tend to help too. Finally, showing us the code is helpful (after you've explained your problem). /msg php-bot
pastebin for more information

JymmmEMC what have you contributed to this conversation? you've done nothing but tell me to rebuild what I've already built and that I don't know what I'm doing… you said what you've had to said and you keep reiterating that you're just trolling
because I've already said several times before that it failes on [dbo].

!+go

it doesn't

but whatever, I'll figure it out

[GO] Gross Overgeneralization. Everything that we tell you in ##PHP is what we consider "best practices". Of course, only YOU know your own requirements, so you may feel you need to do something we told you not to. Just don't say we didn't warn you.

lay off the pipe, sir

hey, thats a nice one
@ GO

hahah yes because OMG STAY AWAY FROM REGEX NOOB is your official best practice

chewy, who in here actually called you a noob?

using php native functions is good practice

JymmmEMC

I call em, as I see em.

haha yeah and you've established that you have 123/89 vision
get your eyes checked

chewy: So you want to TRUST something that you are not 100% proficiant with?

-.-

arguing about this issue won't solve your problem

yes because no one is 100% proficient with anything

you must realize you're in an IRC room and nobody's perfect

chewy, we are actually giving you a better, faster and easier way of achieving your goal..

so, let's try to solve your problem

ASnyde1, liar!

lol

what sean` said

and you can then decide to take our advice or not. That's your decision. But realize that you