SELECT * from diary where DATE_ADDdia_due_dateINTERVAL -dia_days DAY = CURDATE and dia_active=1 # even if dia_days=0

hi all!!!
i need to make a database server with HA, what kind of Tech recommend?

Im using sortables on floating divs
left
when they wrap and I try to sort the last item in the list

#mysql!

weird shit happens
oh

wrong tab
how fast should failover be and what's your budget?

nils_, yes!!!

"Would you like tea or coffee?" - "Yes!"

http://rafb.net/p/BYUDWZ18.html

hmmm … the output of GROUP_CONCAT() seems to be limited to 1024 bytes. I s that true?

"What colours are available?" - "Yes! Of course!"

what's wrong with that thing ?

could be

The result is truncated to the maximum length that is given by the group_concat_max_len system variable, which has a default value of 1024. The value can be set higher, although the maximum effective length of the return value is constrained by the value of max_allowed_packet.

nils_, I need to develop mysql AH. eg if my server crash, other server incoming very fast! I don't know maybe clustering? or if i buy 2 server hosting an NAS storage? what kind of tech recommend?
nils_,

on the low end: master-master replication with linux-ha
high end: mysql hosting cluster

http://rafb.net/p/BYUDWZ18.html why i can't optimise this GROUP BY ?

The result is truncated to the maximum length that is given by the group_concat_max_len system variable, which has a default value of 1024. The value can be set higher, although the maximum effective length of the return value is constrained by the value of max_allowed_packet.

my english very worse… mysql cluster i think so

Thank you. Maybe this is gonna be a task for PHP then ;-)

try KEY(flag, id_gal)
wait, that also doesn't make sense

lol, I should look before I paste

nils_, cluster i think so.

nils_, i tryed
what's wrong ?

well you'll need at least 2 storage nodes and 2 sql host nodes, one managment node recommended.

ALL ?

nils_, humm, that's meaning if i have 2 server and 1 NAS connect over optical fiber?

no NAS needed.

heliostech, it has to scan the entire table to get the result so reading the indexes would slow it down

the problem with shared disk is that the disk is in an inconsistent state when one node dies

nils_, but it's recommended?
OK!

that won't happen with a dedicated filesystem per server, that's why I tend to use replication which has it's own problems.
and, to quote mysqlperformanceblog, MySQL Cluster is a whole other beast
got it

hummm

ALTER TABLE cat3 ADD INDEX (id_gal, flag) BTREE;
memory uses hash indexes by default I think
well my sql is wrong

http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#option_mysqld_max_seeks_for_key

CREATE INDEX `id_gal_flag_btree` ON `cat3` (`id_gal`, `flag`) USING BTREE;

nils_, actually, i have 20 pc with a program that's connects a database server with ip 192.168.0.254, so if my server crash (i don't know, memory fails, nic fails, etc) as soon as the other server incoming. Do you understand me?

yeah you can achieve that with linux-ha or vrrp
so that the fallback server takes over the static ip hosting of the primary
keeping the servers in sync is the complicated thing

nils_, so what Tech do you recommend me?

I use replication and linux-ha

nils_, the other server had similar conf? you know database structure etc..

same hardware, db structure and so on

Ok - two quick questions
I have an auto-increment ID field in my table

OK

When I am inserting into the table, do I do ….,NULL,…. ?

Yes

works, empty string also does, or you just leave it out

Empty string? '' ?

Ok - NULL will work best for me in this situation
Question 2

yeah

I need to immediately get that # back
That ID #

Ah, I missed his autoinc ref.

Is there a quick and dirty way to do it?

SELECT LAST_INSERT_ID()
that's not quick or dirty

nils_, can u say me about your issue?

well it's quick
what?

nils_, oh yeah you are right

Is that a valid function?

thx

How do you put that in php host terms?

no I just made that one up
there is a mysqli_insert_id function I think

ok - I'll check it out
ty ty

If there a way to check if a row exsits and if not add one?

what do I need to do to get an sql hosting dump from mySQL v4.1 to load in v3.23 ?

insert ignore or replace
Android`: can you still dump the table? there is a –compatible switch for mysqldump

Im using phpmyadmin and I cant see a compatiable option

nils_, you said me about that you use replication and linux-ha.

yes

is there an easy way to get a mysql dump thats compatiable from a php script ?

for a web application that is

whats the right way to search only in certain fields for a value? $query = "SELECT * FROM addresses WHERE first_name, last_name, nickname, organisation LIKE '%".$searchterm."%'"; I _dont want to search in all fields in case I match the email or snail mail addresses

oh sorry, I do have an option :| stupid me, thanks

do I need to do 4 seperate queries and OR them?

but you have 2 server, one this on line, if this server shutdown the other server incoming on line that's rigth?
nils_, but you have 2 server, one this on line, if this server shutdown the other server incoming on line that's rigth?

one query, '…where x = 1 or y = 2…'

nils_, with INSERT IGNORE, is there a way to tell which field to look for to ignore it?

thanks threnody

or is that ON DUPLICATE KEY ?

but that's a little weird. are you going to have 4 different search term inputs?

will apply to all unique/primary key constraints
both connected to the same switch, don't know what you mean by line

or will your form say "Enter fname of lname of nickname or organization:"
or will your form say "Enter fname of lname or nickname or organization:"

nils_, so unless I define the primary key it will not work for INSERT IGNORE?

no I have a set of records from various sources where the reqd term could be in any of the fname.lname nickname or organisation fields

there must be a primary or unique constraint, else it won't work as you can have 2 similar rows in that table

nils_, ups!! on Mexico we say on line to referer like uptime

oh
well both are up and running all the time
one is active one is passive

nils-, right, but on the insert do I have to define the field with the primary key

primary or unique, yes.

=_= okay thanks

else there is no constraint failing

nils_, oki!!!
nils_, last question. how to conf that when 1 server shutdown the other one incoming?

that's what linux-ha is doing, the servers send heartbeats to each other, if there are no heartbeats received from the active server the passive changes it's IP

Hi there

hi Goodspeed

Hi shyru

thaks a lot nils_ !!!!!!!!!!!!!!!11

trying to fix this postfixadmin.. but when i get the prompt i type my l/p that doesnt work
then i m looking at the config.inc.php
i see the user name and pass
thats what i m typing

can anyone understand this guy?

I think he's trying to get help on some web application

perhaps. he sounds delusional, as usual.

perhaps a good therapist might help.. hell perhaps a bad therapist might help

anything will help, heh

i m having issues login to my postfixadmin.. mysql -u postfixadmin -p that works when i login

Ok.. what's wrong here.. I get the error that I cannot create the table.. despite the referenced tables have been created: http://pastebin.com/m29e186da .. what am I doing wrong?

Hey guys, I've got the following in my my.cnf: log-slow-queries=/var/lib/mysql/mysql-slow.log and long_query_time = 5 but the file is not being created (even though MySQL tells me that there's at least a few slow queries)
why is it not being created?

I'd like to have some of whatever `mac` is smoking.
you restarted mysqld, obvisouly?

yeah

Shariff, what exactly is the error?

When you insert the NULL value… do have to put it in ' ' ?

no

hrm

otherwise it thinks it's NULL as text

it says invalid

is the column type NOT NULL?

uhhh no - it was a parse error on PHP's side

so anyone with my problem?
log slow queries?

ERROR Code 1005 - Can't create table '.\kevin\k0001_member.frm' (errno: 150)

150

http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html

19.02, 24.34, 23.45 yikes

the_wench, saying bullshits

Now that's something I can use.. I couldn't find the 150 reference
thanks!

what do I have wrong here? I want to find "Anne Brown" "Jim Banner" "dannybhoy" and "Annular Widgets Corp" SELECT * FROM addresses WHERE first_name LIKE '%ann%' OR WHERE last_name LIKE '%ann%' OR WHERE nickname LIKE '%ann%' OR WHERE organisation LIKE '%ann%';

Don't repeat WHERE

willie, do not repeat the WHERE keyword

OK I'll try that thanks

select login from users; how do I show only the first 30 characters of 'login' ?

substring() ?

!m osmosis string functions

osmosis see http://dev.mysql.com/doc/refman/5.0/en/string-functions.html

So ive got an actual sql database from a /var/lib/mysql folder, how to i make this into a standard .sql file without having to upload it to a mysql server or using a mysql server
bSo ive got an actual sql database from a /var/lib/mysql folder, how to i make this into a standard .sql file without having to upload it to a mysql server or using a mysql server/b

I don't see the problem

cool

excellent folks thank you !

Can't

oh damn

Shariff, can you create without the foreign key constraints?

I am about to try that now

Uh, it doesn't tell you where the error is?

Yeah, I can.. but I don't see what's wrong in my reference.. I will try them one by one, trying to find which one it is

SHOW ENGINE INNODB STATUS — what does it tell you?
http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html — tells you what you need in order to make it work

Shariff, is SET DEFAULT valid reference option ?

Hmm.. apparently not..
This action is recognized by the parser, but InnoDB rejects table definitions containing ON DELETE SET DEFAULT or ON UPDATE SET DEFAULT clauses."

i cant find the one i need
LEFT maybe

Yes
LEFT( col, 30)
LEFT( col, 30) AS col

Thanks for your help!

hi
how much can characters can text handle?
or blob

hello
I have 80 items that do not come from a database that I want to match a table against
so I have a select with a where clause similar to … WHERE some_id IN ( 32, 1233, 234423, ….)
because there are so many items to match against, I thought I could make the query faster by creating a temporary table for that data
so I did and it takes very little time to create the temporary table full of those 80 id's with the id's indexed

The some_id are they random, or based on some criteria?

they're basically random

Then how do you select them for a temp table?
What I'm trying to get at is.. why not use a subselect?

CREATE TEMPORARY TABLE friends (uid INT, INDEX (uid)) SELECT 32 UNION SELECT 1233 UNION SELECT 234423 …
how would a subselect help?

I hate unions

yea, but that party is fast
part*
then I tried several things
I tried changing my new query to WHERE some_id IN (select uid FROM friends)

Rigdern, why should this be any faster than the original WHERE col IN (32,1233,…) ?

but that was much worse than WHERE some_id IN ( 324, 234, 23432, ….)

So it's speed you want?

yes

I'd go with the where some_id IN (….)

I thought it might be faster because the data is stored in the database and indexed

Rigdern, the index is worthless

I didn't consider how mysql actually used the index
just tried to find a faster way by trial and error

Ok.. how fast is fast.. and what was much worse?
Are we talking, ms, s, minutes, hours?

seconds
I'll rerun them, 1 sec

Rigdern, the temp table route is bound to have more overhead that making a heap list to compare against
Rigdern, for only 80 integers, an index will never be profitable
parsing the IN list is bound to be faster that parsing an UNION list, plus it is shorter so will move faster between client and server

1.37 seconds for the list
22.11 seconds for the temp table

And unions are evil
:-)

I figured that creating the table would have all the overhead
and it took well under a second to create the table
but it seems I was wrong

Shariff, at least one should use UNION ALL

why is 1.4 seconds too slow?

the full query takes 2.5 seconds
and I started taking it apart to try to figure out what parts are the slowest

Shariff, it sounds a bit slow. i assume the column is indexed

Or the query is relatively complex

the part of the query I have now is 1.4 seconds
and there are a few reasons it's too slow
or at least it seems to slow
it's for a website and I don't think it should take that long for a page to load
bit's for a website and I don't think it should take that long for a page to load/b
I'm only using a few integer columns for matching
and their all indexd

What happens if you drop some of the smaller indexes (less than let's say… 50 recoreds)?

I think there are around 380,000 rows in the table

Then perhaps it's good t keep the indexes right where they are

in the largest table
and there are websites that have tables much larger than that

Rigdern, for laughs, did you try WHERE some_id =32 OR some_id =245 OR …

that load incredibly fast
I did but not for laughs
I hoped it might work
lol

That's not just db design, could also be hardware related

but it was a little slower

that would be slower.

evenings, thumbs

What do those numbers mean?
Why those numbers?

evening.

the id's?

aye

they are id's of users who are considered friends

So they are not random?

no
when you said random before, I thought you meant they had no pattern

Ok.. earlier you said they were random

which they don't

Then how do you know they are considered friends?
surely there must be some criterium to base that on?

that's from another database

ok…

spathi torch InfiniteI Stegozor spoop gwern ShaunES GerardM- soufron t65 zeldafan500 OverlordQ Ceiling_Cat alcarilinque Arria Rhythm Arwen Andrevan wimt inkululeko Pilotguy_aw kmccoy Blacksmith2 morwen switchcat _shawn Laogeodritt AllBlacks ST47 Greeves karynn Hory Dribbles G Bombastus
Pichu0102 Zscout370 lucasbfr FrancoGG goshzilla^ TEST1239 Ctrl_Z Halca Physchim62 Luna-San K__ Martinp23 Random832 Bennity geniice flyingparchment Crogn

medfly TheLetterE-Away devn Muisje ggreer Farosdaughter tessarakt rainman-sr Jonbo sopoforic LoRez CrypticTales ShakespeareFan00 _ DoubleAW NotASpy roland-home imyndunarafl Goplat CCY19840812 Luigi30 ida_mayhem Kwitschibo iwws Newyorkbrad Karlprof Falc bah Sethant JWSchmidt My_Sic kunsole
shimgray Sean_William Huntster jeronim Jocke Deskana cctoide WalterB1 _Danny_B_ nsh Tooby|afk xyzu AzaTht kloeri jaydeear1 jurtti- HemlockMartinis

My advice would be.. leave it as it is now.. and add it to the list for a future update
Awwww

spammer -.-

what was that about?
was there a point?

I'm interested in speeding it up if possible
there are some other issues
I want to display this data in a paged fashion
in order to do that, I have to know how many rows there are so I can calculate the number of pages

well, make sure each column you refer to in your WHERE clause is indexed, for starters

I've done that

also, what kind of JOINS are you preforming?

and then I have to actually get the subset of data for the current page

s/pre/per/

only left joins

If you have the full recordset from the db..stuff it in an array and count the array items?

LEFT JOIN's are expensive. Very expensive

That way you only have to pull that data once and just walk the array (pass it from page to page)

I didn't know that
I could change them to straight joins

an alternate way of doing the same thing is to INNER JOIN the two table and put WHERE remote_column IS NULL
it would speed up your query significantly

cool, why is that?
what I do now is I run a query first to get the count information and then after calculating the current page, I run a second query to get the data

that sounds wasteful
get the data, and count the number of rows instead.
using, of course, your scripted language of choice.

I'll try those changes
thanks for the help

hi there…

exactly.. pull from the database once.. let the business logic take care of the rest

I have an issue w/mysql refusing to repair itself w/myisamchk on a gentoo box
I get "Found block that points outside data file at $LIKE_20_DIFF_VALS"
got any ideas what to do ?

oh and is there a way to time a query from mysql? I've been using the scripting language to time queries

EXPLAIN $QUERY

where does explain show the time?
I only see the time if I type the query into the mysql program
but it always shows the time

?: Is select name from table where id IN (1,2) faster than select name from table where id=1; select name from table where id=2; ?

yey
yes

yes, a single query is always faster.

is IN very fast?

in is basically or AND or

say I had IN 200 different values for a table of 30 thousand rows

[..]

americontje ChanServ GutGrinder Manuel Rprp

still faster.
it's somehow like joining on static values

so it's quite fast?

yep

hey guys

with an index even faster

when I have this
MATCH(%s) AGAINST(%s IN BOOLEAN MODE) AS relevance
relevance is a number
but what does that number represent?

the relevance of the search result

what's an index made of two columns all about?

yes, but is it a percentage

I don't quite understand that

I'm doing a full-text search for my website

anyone know a place to display a business idea ? to get funds, partners etc..

well most times you can only use one index to satisfy your WHERE

but I don't understand what the number i get from it means
if it's a percentage, or what is it, so I can represent it better
in the search results

oh well that's difficult
you might need to know someone or start on your own first

so if you have two conditions in your where you need an index with two columns?

so if there are two columns in your where (for example a and b, where you have many b's for a) it's good to have an index on both in some cases (on a, b)
if you only index a, mysql uses a and then scans the results found in a index for the b values

guess I need to read that part of the manual.

!man multi column ind

Sorry - I have no idea what function you're talking about! but try http://dev.mysql.com/multi column ind

well
it's somewhere!
bitch!

guys i have a problem
i have a field type bit, but when iinput 1 pr 0 , not record the register, but not appear errors

please clarify.

sort cpu by speed… different filters for different products… what kind of db structure would be required?

can someone help me out with http://pastebin.ca/645006 please? I created a db, and gave the user acces to it, but he get's access denied..

is there a way to select a count (row 1, 2, 3, 4…) directly from MySQL? Like SELECT rownum() as i, field FROM table WHERE type = 'q'

hehe, I like your name My pipeband is named after a certain Rob Roy

where i would come back as 1, 2, 3, 4…Just like an auto_increment but for this query
heh, thanks
I'm just accidentally named after him

cool

Rob Roy was a great movie.

you know what's funny? I've never seen it and it's my name!
I keep meaning to
Laim Neason is a badass
err, Liam

it's a sick movie.

how do you do a WHERE statement with 2 fields
WHERE 'field' == 'value' & 'field2' == 'value2'
like that?

replace & with AND

thanks

and don't use ==, =
WHERE `field` = 'value' AND `field2`= 'value2'

I was running mysql on my linux laptop that died. Now I have the same harddrive mounted under windows. How can I recover some database contents?

i thought == made it stronger
no?

no.

aight, nm

Any suggestions?

hi
Can you guys help me choose a WHERE clause?

you need to help us help you first.

yeah

i.e., tell us what you're trying to do, exactly.

i'm got a small problem, i don't know how to finish this statement
`Album Title` = Get Rich or Die Tryin'
how can i close in the value, it has a ' it already

escape the single quote.

thats a part of the data though

escape it.

what if i need it though, ha

in any UPDATE or INSERT statement, escape it.
the quote will be preserved.

i know what you're sayin, if i had 'Get Rich or Die Tryin' it would work, but the title is Get Rich or Die Tryin'
hmm, i don't understand that

then UPDATE tbl SET title = 'Get Rich or Die Tryin'''
done.

if I have a feild with values (hello this is a value), how can I have a where clause that chooses any feild that has a "this" in it?

that goes in the same $sql line?

Gargantua, LIKE

WHERE `fieldname` LIKE '%this%'
no, on 34 lines.

thumbs, what is %?

wildcard

there a link to better explain?

what's that thumbs?

any number of characters

ah
ok thanks

putting ' before ' escapes it and tells mysql not to terminate the string.

airj1012, are you confusing SQL and php?

i'm using php

of course you are.

`Album Title` = 'Get Rich or Die Tryin''' worked
is that wrong syntax

yes, it would.

using pear?

your query is incomplete
we can't tell you if your syntax is correct or not.

ahhh, i'm still lost

wouldn't it need to be $query = "`Album Title` = 'Get rich or dye tryin\''";

the mysql die didn't give me an error
i'll try that one

k

that worked too
thanks
i guess i'll use that one

you're welcome.
the first one didnt work as you wanted it to work.
i believe it just add a "Get Rick or Die tryin" without the '
rich*

can someone help me out with http://pastebin.ca/645006 please? I created a db, and gave the user acces to it, but he get's access denied..

Hello all
When I do this query
SELECT * FROM 'table` WHERE …
Is the table name in single quotes or backticks?

your quotes are mismatched
quote

Use ` around identifiers (database/table/column/alias names) and ' around strings and dates.

ok - so if the table name is in a PHP var $table …
'$table' ?

that's a php question, not a sql question.

oh ok

I recommend you re-read the factoid
quote

Use ` around identifiers (database/table/column/alias names) and ' around strings and dates. MySQL does allow " for strings, but ANSI standard uses " for identifiers (which you can enable with ANSI QUOTES option)

has anyone in here used junction points in windows?

Ok thanks

anyone?

someone?
i need help

where???

Avenger can u help?

get in line buddy
whats the question?

no
i dont know how to install linux

lol

can u help? pls?

ubuntu?

what is
ubuntu

Ubuntu is an ancient African word meaning 'I can't configure Debian'

oh

LIES!
ubuntu 7.04 desktop

huh

it rocks

is that like redhat
ouch

i've got it installed on one of my other hds

DELETE FROM table where blah=1 and blah2=1; Would this delete ALL rows that have both conditions or the first found row?

thumbs y u do that

you're acting a *little* silly

both

That's what "AND" means.
thumbs was it funny?

huh?
ignore 2nd condition

it will delete all rows that meet both conditions

DELETE FROM table where blah=1 would this delete ALL?

It would delete any row where blah=1 and blah2 = 1

how can i make it delete first found
ONLY

all rows that have blah equal to 1

Define "first found"?

Distinct?

what kind of table is this that needs to define blah?

The first row it finds with that there are duplicates

and what is a blah?

duplicates

I made it up

dupes

find them with select count(dupefield) as qty,otherfields from table group by dupefield having qty 1

haha i know

ack
Write something up explaining how to delete duplicates!

as anyone in here ever setup junction points in windows????

OK!

not duplicates… I just want it to delete 1 row that matches the statement lol

Is that related to MySQL in any way? And why take a poll?

statement = condition sorry

you're confusing me.

!m jtm delete syn

jtm see http://dev.mysql.com/doc/refman/5.0/en/delete.html
jtm see a href="http://dev.mysql.com/doc/refman/5.0/en/delete.html"http://dev.mysql.com/doc/refman/5.0/en/delete.html/a

How?

i just joined the first channel i seen that i knew a bunch of nerds would be congregating

pass that doobie, will ya?

You callin me a nerd?

biggest one in here i'd say
not to smart though if you can't help

ok now.

thumbs, is it ok if I pm you?

"too"

no.

Whats the best database type to use for about 100 million entires?

is it ok if I pm you?

engine, sorry

too?

Microsoft Access
They all work fine. Depends on what you need

not to smart — INSERT HERE

you need to find the condition, then apply it. Thus, a second query is rquired
you, of course.

You guys are silly bye peeps!

thumbs, ok, I just did "select * from `mods` where `forums` like 'Test'"
and it returned nothing.

no wildcards there

delete from tbl WHERE `field` = 1 AND `field2` (SELECT … FROM tbl)

oh
lawl

:/
I want your doobie. Now. Please.

gnari, thanks for the reminder dude.

Solution would be to make a unique id per row and just delete where the id matches lol

I agree.

see I have duplicate rows and I just want to remove 1 of them

then you need at least two conditions.

no not true
I'd actually only need 1.
select the unique_id keep that id then delete where pool_id = that unique_id
im doing it in php
so i can store variables
I could also do a select into the delete
but in both cases I need some sort of unique id to distinguish

how do I delete data from a column in a table without deleting the column?

jtm, just select distinct * into a TEMP table, delete all your rows and insert select * from TEMP table

whats a good channel to ask my question?

rb007_, update table set col=NULL

depending on the number of rows, that could be costly.

thanks
(only 160 rows)

thumbs, mot much more costly that adding a unique id column
s/mot/not/
s/that/than/

gnari that's messy
plus you didn't get the point

what if I want to insert the following value into that one column of that table without touching anything else? data is this: a:0:{}

I'm not deleting DUPLICATES I am deleting 1 entry but there is duplicates of the entry.
I just want to delete the first collision

do I have to do INSERT INTO table VALUES(, , , " a:0:{}"); (something like that? or is there a better way?)

If I make a unique auto_increment id for each thing then I can do it

jtm, so if there are 3 identical rows, you want only one delete?

INSERT would insert a new row. UPDATE would update an existing row.
what do you want to do, exactly?

yes gnari

I deleted data from a column. I want to now insert that other data ( a:0:{} ) into that column on existing rows (about 160)

Current solution is simply to just make a unique key for each entry and delete by the unique key.
I currently don't have the table populated.

you want to UPDATE, then.

ok… thanks

why can't you DELETE TABLE WHERE BLAH IN (SELECT TOP 1 FROM TABLE WHERE BLAH=1)

Avenger, that wld delete all duplicates

ah

something like UPDATE users SET data="a:0:{}" ?

rb007_, yes, but i would use single quotes

ok, thanks

unless he did a DISTINCT

gnari, thanks… that worked

jtm, unless WHO did a distinct WHERE ?

Avenger in the SELECT TOP 1

jtm, would make no difference at all

oh
nevermind
i see

top 1 will only select one row won't it?

yup thus leading to all rows of that being deleted

touche`

leaving*

yes, but in this case it is redundant, because of the WHERE IN

Anyway I have the solution

i've never seen this before, anyone know what it means?
Unexpected character in input: '\' (ASCII=92) state=1 in

are you doing a bulk insert?

whats considered bulk?

airj1012, what is the query that generates this error?

nevermind, if you were doing it you'd know

just this one line i think
can i paste it, or you want me to pastebin it?

one line should be ok

echo "trtd class=\"picture\" rowspan=\"5\"a href=\" \"img src="\ya.jpg\" alt=\"The Massacre-Special Edition (Explicit)\" border=\"0\"/a/td";

I hate when you get into situations were if 2 selects are called at the same time they could ruin your code under special conditions

it's probably something small i'm over looking

airj1012, looks like html to me

?

i.e. no control over locking on selects

jtm, does mysql not have SELECT FOR UPDATE ?

i don't know
it's hard to explain

airj1012, src="\ya

I have C++ program that I am working on. It is a windows service (but it can be executed from command line. When the program exits I get this message. Error in my_thread_global_end(): 1 threads didn't exit
Quick google shows that this comnes from mysql
Any ideas why this might be hapenning?

i'm still missing it

\"

imagine 2 users inserting data into a table then both call to get the count of how many rows match (AT the same exact time) if a certain time one user is past the call ehh hard to explain but i think ill just catch it for an error.

oh
ahh

It's a dilemma where 2 users can override eachother kinda

told ya, so small i kept over looking it
ha, thanks

one of those untestable cases
And a probability of happening is probably less than 0.001%

jtm, you arev using transactions?

hmm?
i could maybe run into a case where 2 users if it happens at the EXACT same time would think everything is OK when it isn't
I'm not sure how to test it
It would have to be the EXACT same time
and even so it should catch it
because INSERTs are unique, i.e. locked in InnoDB
2 users can't insert at the same time so they both should get different counts on the table.

hey how do i export a database called realmd to a sql file in the mysql console?

unless 1 user Inserts AS another user is done inserting but the first user inserting catches up and gets the same count that user2 has and they both have 301 or something when 300 is max allowed therefore they both fail and there is 2 removes.
I guess this sounds fine

!man mysqldump

see http://dev.mysql.com/doc/refman/5.0/en/client-utility-overview.html

^^

I have a PHP array and I want to select from a mysql table where one of the columns' values is in the array
similar to PHP'
s in_array() but right in the query
Is that possible? Is there a function for that?
oh, I see IN

Whats the best engine to use for a database with about 100 million entires?

God dammit. I'm confused. ASC/DESC seem to be reversed based on the column type.
ASC = "arrow up", and DESC = "arrow down", right?
But DESC seems to show the oldest DATETIME in the bottom.
How can that be?

How can i get a list of rows that have a duplicate field?
Er, i think i found a way
Ok, im trying to figure out some mysql logic. I have two tables, one with clients and one with products. Because of bad design, i have some accounts that have been duplicated (same email address). Anyway, i have figured out the logic to show me only duplicate accounts, but now i need to check the
products table to see if they have any products assigne to their userid. Any tips for returning only userid's that do not have a product

Whats the default for the product id?

Well, the productid is in a separate table and its primary key is ID
Anyway, each one has a userid assigned to it

Ok so each product has a user id assigned to it?
ok ok I see

http://pastebin.ca/645139

I'm not sure how to do that in sql, I would write a small php script to find them though

Thats what im using to give me a list of userid's with that have a duplicate email address
Ah, i see what you mean. There is probably an easy way to do with mysql, but i can do it with php easily as well

hi

Greetings!

I have a statment like; SELECT field_id, CASE field_id WHEN 10 THEN FROM_UNIXTIME(value,"%Y") ELSE value END, subscriber_id FROM `subscribers` … although when I execute it I get; "illegal use of collations for operation case"
If I remove the FROM_UNIXTIME formatting parameter… it works
e.g.

x.x
well, brice^3….

SELECT field_id, CASE field_id WHEN 10 THEN FROM_UNIXTIME(value) ELSE value END, subscriber_id FROM `pommo_subscriber_data`

is this a valid mysql query .. GRANT SUPER ON * TO user@'%' IDENTIFIED BY 'somepassword';

no

I like the ^3

hmm , well what would it be to give super priviledges

"Grant all on *.* to 'user'@'%' identified by 'password';

ok so thats it ..
thanks

yeah
np

/

yeah, cubybrice, it's cool

am I conducting a badly formed query?

well, I see a "where" in the "select" clause so….yeah, baddly formed

basically… if field_id is 10… then wrap value in FROM_UNIXTIME
it's a case clause?

eh, I have my OCP…we never covered a "case" clause…..I've never even heard of such in a select statement!

aye
they do exist
like I said.. it works fine if I don't include the FROM_UNIXTIME formatting param ( FROM_UNIXTIME(value) vs FROM_UNIXTIME(value,'%Y')

x.x I have no idea!

so I wonder if it's an escaping thing
using FROM_UNIXTIME in a CASE clause

….consult ze man!

grant all privileges on xxxxx to 'xxxxx'@'localhost' identified by 'xxx' with grant option;
this says no database selected ?
any ideas?

because you need to provide the database :p

i did provide one

grant all privileges ON database.table to 'xxx'@'xxxxx' identified by 'xxx';

how can i list database ?
via CL ?

CL?

commnd line

you type in exactly what I just showed you :p
did you notice that you forgot "ON database.table"?

do i need table ?

or, if you want it to have global permissions, just type "on *.*"

i just want it on 1 db

ok, then "on database.*"
gah, must I explain everythign!

error

lol

fine…here' I"ll explain it one more time!

grant all privileges "on open.*" to 'open'@'localhost' identified by 'open' with grant option;

"GRANT ALL PRIVILIGES ON database.* TO 'user'@'localhost' IDENTIFIED BY 'password';
"
my gawd, think headed
there, do you understand now?

i got it

FINALLY
gah…check hte man before you come here!

lol?
now i just need too dump a .sql file into a db

x.x

lol

hello
i've got a problem can you look over it pls? small code http://nopaste.info/9840f29771.html

Doing a SELECT and an INSERT?

seekwill you must know im not an sql coder i just want to insert something to my board
normaly im coding c++
SELECT * FROM `phpbb_album_config` WHERE 1 i forgot this at nopaste

?
so whats your problem?

the error code
user pics limit will not be createt

?

i dont know how to explain
you see the error code at nopastE?

where what = 1?
where 1 makes no sense

wait ive got a new paste i think its better http://nopaste.info/cbce54f422.html

then the table doesn't exist?

i createt the table
wait
shure i created it

yeah
then rerun?
what other errors?

wait i think i've found the problem

if i have an ordered list
and change the ordering this could be costly
is there an ideal way to set the order of things so that at most only one change is needed?

i've got it thx to you

welcome

anyone able to help me with a nested GROUP BY syntax? I'd want a table to be grouped by a column, and then have that result grouped by a second column (using group_concat too)

I really suspect you'll need to use a derived table query for that
select x, baa, count(y) from ( select x,y,z, count(a) as baa FROM tbl group by x,y,z) group by y, baa

oh, havent heard of derived table queries before.
oh, thats a derived table query.
give me a moment to try that.

Yes, I've heard them referred to as "anonymous views"
I think mysql people normally call it a "derived table"
there is a good chance that this won't be an efficient query, unless the outer group by is efficient and produces only a small number of rows.

hmm, I end up with "Every derived table must have its own alias"

Ok, yes, that is true
you need to alias is
alias it

well, I just found out about the existance of group_concat, and it could replace some code I've been using ruby for.

select … from (select … from tbl where blah) as derivedtbl
group_concat is very iffy, it comes with lots of warnings
Firstly, mysql does NOT implicitly order groups,
Secondly, group_concat has a maximum length after which it truncates the result (with a warning)

oh?
thats bad new.
err, news.
any idea about the length? rather 100 or 10000?

there is a variable group_concat_max_length or something, you can set that higher
But whatever you set it to, it can be exceeded
I think the default is 1024
as all aggregate functions except group_concat are associative, order within a group doesn't matter, so mysql doesn
doesn't order them by default

I see. thanks a lot.
oh, I found a ORDER BY NULL which is suggested to append to GROUP BY, if you don't need a sorted order.

That's for order the *groups*

using explain it showed me I'm not using filesort anymore, which is good.

it still won't order the rows within groups

I see.

ORDER BY only affects the order the output of the query comes
not the rows within a group
because for COUNT(), SUM(), MIN, MAX, STDDEV() etc, it doesn't matter anyway

mark, mind if I ask a second question? is there a way to define something like a constant that is used for a query?
e.g. :
I have a (PERIOD_ADD(EXTRACT(YEAR_MONTH FROM CURDATE()),-6)*100)+1 to get the first day of the month 6 months ago. now I'd want to use that date inside a select statement to only get rows with a newer date.

Well, you could set a constant on the (mysql) client side and just put that in

it doesn't feel right to have that complicated calculation inside my select statement, as I assume it would be calculated for each row.

Or you could set a session variable and use that, but that sounds a bit iffy, as if your client doesn't support batching then you'd have to do it in a separate query.
You could also make a stored procedure
Provided you're happy with the implications on the maintenance of your app

okay, so I guess a constant on mysql, although I'm unsure about the implications. gonna search the mysql reference manual.
….as I've not heard of a stored procedure either

select 42 into @blah; select @blah;
But if you execute these as separate queries from the client layer, be aware that if something strange happens in between and you get a new connection (e.g. reconnect at a lower level), then the variable disappears.

hrm.

But the same problem exists, e.g. with temporary tables
Or anything that involves setting a session variable

so there's no way to set it once and mysql saves it forever?
or should I create a table with one row for that?

You probably don't want to do that
You could create a table with one row
Surely the first day of the month six months ago will change about once per month?
Is this just for optimisation purposes?

well, what I'm aiming to do is:
I want to restrict my query to the first day of 6 months ago, and then instead of returning the row.date, return the days since that 'first' day.

Why don't you calculate that day on the client side?
and pass it in as a literal date value

aka the group_concat(days_since_first_day) (note, this column obviously doesnt exist) would then return something like 1,4,6,12,53
I assumed it's faster to do that inside mysql instead of returning the dates and then letting ruby convert the date to days_since_day_one.
especially as it should also cut down I/O.
it doesn't feel right to have ruby create thousand of date objects, subtracting them each from another date object to then concat the result, if mysql could do that.

I mean, calculate the day six months ago on the client side, then do the per-row date calcs in mysql

oh
something like SELECT DATE_SUB("2007-03-01",date) from … ?
yeah, sounds reasonable

yep

looking to get query with a piece of data from the bridge entity. I have the following query: " SELECT article_id, article_name, article_text, author_id, user_name, submit_time FROM articles,users WHERE users.user_id = articles.author_id ORDER BY article_id DESC;" I need to add a column with a
field from a table that carries the foreign key of users and foreign key of articles (essentially a rank, unique to each user and each table), any suggest

….x.x, I hate CAT join

If i have a innoDB table with 3000 rows, and i want to add an autonumbering field to that table. How do i best go about doing that ?

thanks a lot, you've been a great help.

insert column tablename (column name auto increment);

You can use an ALTER TABLE to do almost any kind of alteration, including adding auto increment columns
You can change the primary key
beware that almost any kind of ALTER TABLE involves rebuilding the table, which is going to be slow on a large table
but 3k rows is nothing
If you want more control how the IDs are allocated, create another new table, select all the data into it (with the appropriate ORDER BY), then drop the old table and rename the new one

hmmm yes
a new table
i have to then loop each element from the old table right?

No, use a insert select

How does that work?

create table newtbl like oldtbl; alter table newtbl .. whatever atlerations…; insert into newtbl select cols from oldtbl order by whatever;
Look at the docs for insert select
it's pretty easy really

http://dev.mysql.com/doc/refman/5.0/en/insert-select.html ?

anybody with knowledge of mysqlnd here ?

then drop oldtbl; rename newtbl oldtbl
Yes.
Consider ALTER TABLE first though, it's easier
you can add a new primary key by dropping the old one and recreating it

did I explain myself well enough? is there a way to select (maybe through subqueries) fields of another table (bridge entity) to two tables already in join.

Why can't you just join the third table as well?

i have a table called users_articles that is storing "ranks" for a particular combination, so the "rank" field would depend on what user_id and what article_id match in that bridge entity
i'm a bit confused on how to join that
SELECT article_id, article_name, article_text, author_id, user_name, submit_time FROM articles,users WHERE users.user_id = articles.author_id ORDER BY article_id DESC;

hmm, I can't get rid of the Using temporary; Using filesort in my explain statement. my select query is something like:

3 ORDER BY date;

and I have an index(criteria_id, date)

Do you have an index on criteria_id ?
Is it really a problem?

I honestly don't know. I'm just trying to do it right
and from what I read, having one compound index with the first column used by the WHERE and the second column used for the ORDER BY should work.

hmm
I think doing select * is a bad idea
you should definitely not select anything which is neither in your GROUP by nor an aggregate function

well, I'm not doing select * anyway

mysql allows this but I'm not sure why

just abbreviated the statement

remember that ORDER BY happens after GROUP by
so it will pretty much guarantee to do a filesort unless the thing you're grouping by is the index it happens to choose

so I'd need a compound index with the where as first, order by as second and group by as third.

and I think the WHERE Takes higher priority
No, I don't even think that would help
some queries always have to use a temporary

I'd just need one index on that table.
http://dev.mysql.com/doc/refman/5.0/en/order-by-optimization.html

I am quite a newbie with optimisation

"In some cases, MySQL cannot use indexes to resolve the ORDER BY, although it still uses indexes to find the rows that match the WHERE clause." …
"The key used to fetch the rows is not the same as the one used in the ORDER BY:"
guess that's the problem.

Is the optimisation of this query serious a problem?
Do you have 1,000,000 rows?
and is it run often?

yes, I will have 500k rows once I go live with my app, and that query is the most used query by the users
a user online might run that query every few seconds
it's basically the core of my app, and the only query users really need.

maybe another strategy might be better
is it counting the number of users by city?
or the top ones?

nah, users select criterias and then get a result for the criterias by city, sorted by date

I see
well, remember that the sort happens on the results, the query might still be fast if there aren't that many rows returned

aka "show me all cities that recently had more than x degrees celsius and a low humidity, and show me when that occurred"

you should really profile it with 500k rows
How long does it take with 500k rows?

on my dev machine I just have 20k rows, and it takes 0.05sec in average.

Well, put another 600k rows in

I still need to commit the recent changes to the production machine - as first step of my optimization I created a table that doesn't need joins (aka it's saving the city name instead of only referencing the city.id)

Joins are not that bad, particularly if one of the tables is small (i.e. cities)
as it will fit in ram

well, if you're online for another hour, I can let you know how it goes

g'day

tor

hi

just a quick update: 100k rows, a nested select like discussed above: 0.007s in average. previously, with my join table, I was at 0.05sec.

These timings are still too short to get an accurate idea
try popping a million rows in

how?
is there something like INSERT(rand)?

I normally write a test program to insert lots of junk in

plus I can't even insert anything, I'd still have to insert valid ids.
hmm, guess I'll write a script.

hey
i'm having a few problems trying to sanitise my input into mysql
atm i'm getting a whole bunch of 's
when i select * or whatever
but they don't go through normally
how would i stop that from happening?
(without base64 encoding my text?)

You need to use correct escaping if you're going to put data into sql
Your best bet is to use parameterised queries instead
these are available in most client APIs e.g. Perl DBI etc

hi again…..can some help me to solve my problem ? http://evo-net.dyndns.org
what's going on there ?

markr?
i am using a paramaterised query

Is there a way to refer to a calculated field in a second calculated field? For example, SELECT (col1 + col2) as calc1, (calc1 + col3) as calc2 ?

but i'm swtill getting the prpoblem
xatrix, whats your problem
mark, with \n's, etc.
it will enter
it just screws up when i look at it

that site is unreachable
You could use a derived table with the original calculated field in

Well, this is actually going to be for a derived table itself, but I suppose that would work.

xatrix, site is unreachable
mark, it seems that it just screws up mysql itself
(the client)

yes….there's an error in mysql query, i guess….

what exactly should i do to solve it ?
ah…sorry…there's a temporary server shutdown….

SELECT * from diary where (DATE_ADD(dia_due_date,INTERVAL -dia_days DAY) = CURDATE()) and dia_active=1; # even if dia_days=0, my results are behind one day. in other words, dia_days must be -1 for an item to show up on the due date. What am I doing wrong?

why not use DATE_SUB instead noesis?

What is the difference Jax ?

use NOW() instead of CURDATE too
and don't change the date of your column…. because it won't use indexes that way..
what are you trying to do? getting entries newer than x days?

can't connect to local mysql server through socket /tmp/mysql.sock' (2)
freebsd server
any ideas?

falieson is the server running? i.e does /tmp/mysql.sock exist?

no..

Jax.. dia_days is just an offset. for instance, if i set dia_days to 2.. a diary item must come up two days before the due date. if i set it to 3, it starts showing two days before due date, and to getit 5 days before due date i set it to 6.. etc

what does /var/lib/mysql/yourHostname.err say falieson ?
noesis ok SELECT * FROM `diary` WHERE dia_due_date = DATE_SUB(NOW(), INTERVAL dia_days DAY);

there is no /var/lib/

falieson then check your /etc/my.cnf whata datadir is set to
or /etc/mysql/my.cnf or wherever your mysql config file is.

thanks Jax.. going to try that query now

Ok, I'm doing a query with a WHERE NOT EXISTS subquery that uses a fairly complicated derived table. It's slow, I'm guess partly because it re-derives the derived table for each subquery. Is that likely, and is there a way to remedy it?

I saved the file at /usr/local/share/mysql/my.cnf

what is datadir set to? and are you starting mysqld pointing to that config file?

hi there!

http://81.174.174.115/famp.htm

I'm storing the date when an record is created using NOW (and a trigger on update/insert). Can I change the timezone that is used?

Ack…its impossible to find a desent MySQL GUI tool

http://dev.mysql.com/doc/refman/5.0/en/time-zone-support.html ?

(1241, 'Operand should contain 1 column(s)')" mean?

roxlu you should do that upon retrieving with CONVERT_TZ(dt,from_tz,to_tz)

select (recid, title, body) from recdb where recid=1;
ah

yes but it wold be easier to use the timezone for the location where it is used, or not?

no, you should store the UTC Datetime, and store the TZ
then upen retrieval you can always still get the correct time, next to the UTC time.
that way you can compare times / dates more easy in the db because they are all in UTC

so I just said fine and saved it at /etc/my.cnf - thats where I thought it was supposed to go anyways. how do i start the server?

Okay, so if I understand it correctly… the UTC is just one time measure and per time-zone hours/minutes/seconds are added/subtracted?

falieson try starting it normally… mysqldsafe or so

why does there not exist a mysql GUI tool out there which actually works?

roxlu yeah, hours only
TheGoldDIggah the one in PhpMyAdmin works quite well
at least the latest version in the beta version of phpMyAdmin

Okay, but is it possible to change the default TZ? (because else I need to change lots, and lots of queries)

roxlu yes http://dev.mysql.com/doc/refman/5.0/en/time-zone-support.html

Jaxyeah…but there is no databasedesigner or query builder in phpmyadmin

Okay, great.. so this one of the thing I needed to know before :-) (feature specs suddenly changed at the end of the project )

find / |grep mysqldsafe returned null

do you know where I can find a list of timezone-names that can be used for mysql?

falieson just run mysqld then
TheGoldDIggah yeah there is
click on a database, then hit the "Designer" tab on top
roxlu you need to install them
read the whole page there please..
it also says which table they are in if you install them
falieson and read `man mysqld`
says which file is the default my.cnf file etc
mysqld –verbose –help

0 with the time whereas curdate() does not include time

haha - I just was

http://dev.mysql.com/doc/refman/5.0/en/installing.html
noesis don't use that query.

0"' would set the UTC time to Eastern Daylight Time

it will not use your indexes.
roxlu no.. read the damned manual?!!?!
time zones are like 'Europe/Helsinki'

0' or

USE mysql; SELECT * FROM time_zone_name; will give you the possible time zones

And as EDT is -4h or UTC I thaught it was correct

roxlu ah sorry, didn't see that. try it

okay
(was just checkign, sorry)

SELECT * FROM `diary` WHERE dia_due_date = DATE_SUB(NOW(), INTERVAL dia_days DAY) and dia_active=1; # in other words i should use this?

yes
perfect
just make sure you don't use functions are your columns in predicates (WHERE statements)
because then it can't use the indexes anymore.

slow queries

just noticed now that you accidently put it as = date_sub and i changed it to = and now it works fine

ah sorry, very good.
doing too many things at once

indeed.. but why wouldnt the other function use indexes?

because it has to calculate the new value for each row, instead of comparing to the value you calculate one time with DATE_SUB(NOW(), INTERVAL dia_days DAY)
in other words, it has to process each row of the database first (perform calculations on them) instead of using the index

you mean it calculates the now() in each row?

no
it calculates (DATE_ADD(dia_due_date,INTERVAL -dia_days DAY) in every row. Read this one http://dev.mysql.com/doc/refman/5.0/en/mysql-indexes.html
run both queries with EXPLAIN in front

ah ok… but thanks very much jax!!! you have helped me so much. I appreciate your expertise

you'll see that one will use a temp table (probly) and the other will use an index

hey
my mysql results are odd
actually, don't worry
when my results don't have 's in them
title is result[1] and body is result[2]
however with 's, my result order changes
?
what would cause this?

so it turns out what I was missing was mysql_install_db

What is an errno 150?

perror 150
Foreign key constraint is incorrectly formed
Use the "perror" program to identify error nubers

I have a simple query…select * from mytable order by id desc limit 5, is it possible to reverse the order in which the results come back?
for example, that might get rows 10 9 8 7 6, I'd like it in the order 6 7 8 9 10

You want the first 5 ID but backwards?

of those results

select * from (select * from mytable order by id desc limit 5) as top5 order by id;

aha, thanks :-)

hmm, i'm kinda stuck with this seemingly simple problem..

are you wearing a bucket on your head?
what's up OneManBucket?

i have a table where 3 columns are (integer) references to a second table containing text values

ok

a row might look like this [row1] [key1] [key5]
and key1 and key5 are references to "table 2"
i want to select row1 and substitute [key1] and [key2] for whatever values are in the corresponding rows in table 2
got it?
[row1] [Anders Andersson] [Tor Torsson]
doing a "select … key_column1 AS table2.name && key_column2 AS table2.name" won't work.. it just puts the same value in both columns
and the reason i'm wearing this bucket on my head is because mentally baning my head against this wall of a problem is starting to hurt =(

one sec
http://pastebin.ca/645280
http://pastebin.ca/645281 , there's some data and a query
I did two left joins onto your name table to lookup the names, if it can't find a name, it'll put NULL instead

one moment, i'll have to try this approach
too long since i did the sql labs in school =P
haha! bucket removed!
thank you lots
so basically what this query does is select "table2" multiple times
and with every join you use one of those "fresh" copies to merge with table1

yep

how can I have an auto_increment field that starts from a particular number rather than 1

ALTER TABLE tablename AUTO_INCREMENT = 42;

Tili, the question is why do you think you need that

but this will increment each time with 42
I have to use a phone number that increments.

that means it will start with 42, then go to 43, then 44 etc

ok cool. this is exactly what i want. i thought it was interval

hi, is posible creat an FULLTEXT index in Innodb tables ? (i don speak english =S)

InnoDB does not support FULLTEXT indexes unfortunately

tomize, and.. how i can use for example: SELECT * , MATCH (title, menssage) AGAINST ('$search') AS puntuacion FROM ARTICULOS WHERE MATCH (title, menssage) AGAINST ('$search') ORDER BY points DESC LIMIT 50
?
articulos = articles

Comments

seekwill ive debuged it and ive found what causes the error but thats what i dont understand its a simple SELECT

Grouping categories must be done in PHP, true? However, are all rows downloaded in correct sequence do to it? How about changing the sequence of categories?

hehe. i found that in a different irc channel. it's always been zippier than other pastebins for me

I'd like them one at a time….

Sorry. Change that COUNT to SUM.

Perhaps I'm going about this the wrong way. How about how do I change all the column names to lowercase?

does it matter ? is mysql case-sensitive in entity names ?

one at a time, using LATER TABLE syntax

fatpelt, i've liked pastie.textmate.org

ALTER TABLE*

I'll start up the FreeNode Campaign to Swap the A and the L
and change my name to ldlptr

did you try to implement possibility of changing sequence of categories?

well that being the case I'd like to put it in a nice programmatic loop hence the earlier question

no
but it is implemented in another module
the categories module
i'm not quite sure how
it uses nested sets as well

i think the change of "left" and "rights" of all lower categories is required when we change the sequence. We can sort by name as well.
I know when i looked at example of tree with left and rights marks, i thought getting higher categories is impossible. However, articles say it's possible.

well, you could cobble something together in an app like php or perl, but by the time you got it tested and finished, it'd be easier to just do it manually.

mysql internally returns the number of rows available when you do a query, is that correct?

ya

know how you can grab that in Python or php by chance?
looking for a few references to get me a head start :P

mysql_get_num_rows() i think it is in php
that is more of a #php #python question

ya I realize that
hrm i think that just gives the length
i can literally get the entire result set size though, even if i only select 30 of them, right?
w/o doing an extra count() query

ya.. you never said you did a limit
SELECT SQL_CALC_FOUND_ROWS bla1,bla2 FROM table LIMIT 0,30;
SELECT FOUND_ROWS()

that will give it then?

it will run the query to return the 30 rows.. then the second query will return what could of been found if no limit was there

hrm, found_rows() returned 1

5

ya?

well of course it will return 1 if you do a count()
since count returns 1 row

the count is aggregating
its returning 1000+ rows

no

yes it is
1091

yes it is.. but in sql.. its getting 1 row
the 1091 from count()

Showing rows 0 - 29 (1,091 total, Query took 0.0944 sec)
no its not
or i wouldnt have this issue

sigh

jY, im aggregating the results, its returning count()'s but for each row
so its giving me 1091 results, but i want to the total number of results, without doing a subquery
and if i can find a way to not have to do select count(*) on every query for pagination (by using this) that'd be a huge help as well

yes.. you do pagenation like i did
there should be no count(*) in your sql query
ELECT SQL_CALC_FOUND_ROWS bla1,bla2 FROM table LIMIT 0,30;
returns the first 30 rows

ya, that seems ok, and sounds right according to the documentation

SELECT FOUND_ROWS() returns the total rows that would be returned if no limit was in there

its just not working for this query

cause you have a COUNT() in there
so sql returns 1 row

its not returning 1 row

yes it is
well you are grouping
so its not gonna return them all

exactly, im grouping :P
so theres 1k+ rows, w/ count values in each
i need to know the 1k+ value
phpMyAdmin seems to display it fine
my assumption is they were using this method

what field type do you use for a number?

what sort of number?

a number between 1 - 10
inc decimals

inc decimals?

including decimals
1.24 etc

crazyryan1 a float ?

How about the DECIMAL field?

what sort of precision do you need?

Really don't want to use FLOATs

2 dp

decimal it is

ok

I'd really like to know a real-world use case for FLOAT/DOUBLE

what would i use for id?
int?

Sure

okay, finally

seekwill not in a db but in electronics design

Well, I mean in DB

for the decimal field type, i put the limit as 2, does that mean numbers that are 3 digits won't go in?
decimal(2,0)
probably but i dont have time to read them

Yes you do

hehe idle sh…

jY, it was phpMyAdmin messing it up

oh you were doing them in myadmin
no wonder
ya that next query needs to be the next query run to work

hey guys. say i have a table with id and file, all i know is id…how do i return a count of all records that have the same file as the id i know?
do a join on the same table?

better do a subquery if you only need one ID to start with

i only *know* 1 id, but only need a count to know if the file is in use by more than 1 record
but i dont know the file

well a self join is ok use an alias

that's what I mean, so you need something to determine the filename from the ID
and then a simple select on filename
but since you'll be inputting just a single ID to that first step, a subquery might be more efficient

http://pastebin.ca/642282 so that should work, eh?

not sure what you mean with the dots, but syntactically, yes

yea, ignore the php in there.

no, not php - the *dots* around your id in the second select

that would be escaping the string in php.
but yea, thanks for the help, i think it works.

I came up with SELECT COUNT(*) FROM table1 WHERE filename = (SELECT t2.filename FROM table1 AS t2 WHERE t2.id = yourvalue), since I think you dohn't need to alias the first table occurence in a subquery (no chance of ambiguity)

hrm, it was working….
you're probably right. i always alias all if i alias one. just habit

but you'd better make sure the text field you're selecting on matches (no whitespace, no case sensitivity etc)

they'll be identical or very different.
but it stopped working….strange…it worked the first go round.

have you tried the self join ?
you should probably test and EXPLAIN both to see how it optimises each

is there a way to see how many clients are connected to mysqld?

well, yes

why is count returning ''
shouldn't it return = 0?

could anyone tell me how to stop the 2nd query using filesort? http://nopaste.com/p/akzIgOXPF the first doesn't use it yet the 2nd is the same but without a WHERE.. i don't understand why it can't use the listname index even after reading the
order-by-optimization page on the MySQL site

megasquid SHOW GLOBAL STATUS

madriss, add table definitions to the pastebin

how do i get the table definition?

adaptr, thanks, which stat is it? Threads_connected?

best guess, yes.. I thought connections, but that turns out to be connections since startup
it's 24 on my box, which seems high to me

madriss, show create table tablename;

ok thanks, 1 mo

adaptr, alright thanks

or else perhaps
!man status

see http://dev.mysql.com/doc/refman/5.0/en/show-table-status.html

http://nopaste.com/p/abd5BW4oz

ermm.. not that one
!man stats

Sorry - I have no idea what function you're talking about! but try http://dev.mysql.com/stats

!man global status

Sorry - I have no idea what function you're talking about! but try http://dev.mysql.com/global status

pfft

don't understand why the query with the WHERE in it uses the listname index, but the other one can't use it

probably needs a compound index

could you advise what exactly i need to index?
i think i tried "listname, rateid" and "rateid, listname" but that didnt help
i guess its not because of the JOIN, as the first query on there doesnt need filesort for some reason

madriss, how many rows in 2007caws

2394

heh 50%

hmm
actually thers only 2305
but autoincrement is higher i guess some have been deleted thats why
what u mean 50%?

Class 'mysqli' not found in

run analyse table then retry
derekl, fix your php setup

ok
analyze status Table is already up to date
still uses filesort

madriss, how many rows in the result 1?

you mean the first query? there was about 29 rows i think.. ill check
the one with the where in it

no the second
if all 2305 then use a better data set

it should be all 2305
im just wondering why it doesnt use the index
there is no WHERE in the 2nd one.. its just selecting all rows and ordering by listname, but ignores the index and uses filesort

It has to read the entire table, reading the index as well is overhead

oh right
so it's not possible? :s

no a waste of time, hence the comment about a more sensible data set eg 50% of a table

ah i see
ok that makes sense
im trying to optimise all the queries on the website.. and one of the pages allows you to view a list of everything in the table
so i guess i should not have that feature

never allow a full table slow download etc

maybe ill learn how to have it split into multiple pages

offsets

than the id's already passed.

is there a tut for how to show a whole results set on multiple pages?

google "paging"

ok thanks
thanks wench

It's been a pleasure serving you, madriss.

Is it possible to combine two columns of a result set into one column and then DISTINCT it?

makesa bit more sense now

afternoon shift has arrived, hello snoyes

ill try paging it then, thanks everyone who helped

CONCAT() to combine them, DISTINCT operates across all values in the result set anyway.
howdy archivist

orf home time

soon

#quit

hi, I've got a test server, and mysql hosting is running 10 processes, how do I make it launch fewer processes ?

can someone please tell me what is wrong with this query? http://pastebin.ca/642331

aarcane, best not to worry about the first few some are background worker threads

Probably need quotes around the email
and you should be doing some escaping of that posted value, to avoid sql injection. At least use mysql_real_escape_string()

archivist, I'd prefer to only run 5 or so instead of a full 10 though, esp since between them they're using 114 MB of RAM

the quotes didn't work

swimrr, and learn to echo your sql to see what you are doing

$query = 'SELECT email, password FROM users where email = "' . mysql_real_escape_string($_POST['password_signin']) . '"';
else echo mysql_error() . " in query " . $query;

let me try
thanks, why do I need to escape the posted value?

What if I go to your site and submit my user name as something like ' OR 1 –

I don't know - i'm new to this

thenh he could break in
is his point

figured as much - how so? what does entering ' or 1 do ?

well how do I get memory usage down ? 114M is an aweful lot of RAM to dedicate to a database for testing purposes only

Without escaping, your query becomes SELECT email, password FROM users WHERE email = '' OR 1. Which means I can pull out any email host I want.
That's not so scary. But with a little more work, I could make your query return passwords in the email field, which you print out a few lines later, and then I can log in as anybody.

huh - interesting….where can I read up more on mysql security?
I know there are lots of risks I need to be aware of

http://dev.mysql.com/doc/refman/5.0/en/security.html
although that's more server installation related

this is hardly mysql security - it's basic web site security, and law one of same: NEVER pass unescaped values to scripts

can I upload a schema and import it to an actively-working DB so that new columns / tables are added but the information that is already there stays in place?

http://www.tizag.com/mysqlTutorial/mysql-php-sql-injection.php

thanks again

If you need to alter table structure, you'll need to use ALTER TABLE, rather than creating a new table. You can insert new data all day long without any problems.
xaprb's toolkit has something to help create the required alter table statements if you have two dissilimar tables, I think.
toolkit

xaprb's MySQL Toolkit (http://sourceforge.net/projects/mysqltoolkit/) includes tools to compare databases across servers (such as master to slave) and bring them back into sync, profile queries, and other handy features.

What I mean though is can I do an sql export from my new schema, sans the actual rows of data, and import it into another source where the schema is all that is used and the data stays the same?

No, the export will probably create CREATE TABLE statements, and you need to know which fields are different and create ALTER TABLE statements.

Can anyone tell me why no indexes are being used in this? http://pastie.caboo.se/84183

How do I merge the values in two mysql columns into one column?
As in
SELECT (`A`,`B`) AS `C`

concat

concat is adding the values together
well combining as strings
which i don't want

so what do you mean by merge the values?

concat

Basically
If A has 1,2,3 and B has 1,2,6
I want C to have 1,2,3,1,2,6
then using DISTINCT i get unique values

concat(a,",",b)

……..
I already said I can't use concat it's not right

whats wrong with concat?

Because it literly adds `A` to `B`

and you want?

I want two seperate values in the same column from the sources A B
not one value added together

hola!
so I've got a mediumblob field w/ a bunch of text in there (UTF8) and I want to do a case insensitive search on it.
any ideas?

HighAkujin… according to what you wanted ….. concat gives you what you want
select @a:="1,2,3",@b:="2,3,4",concat(@a,",",@b);
instr(blobfield,'what you looking for')
^^TimLaqua

that's case insensitive?

its all case insensitive

well, I did a old_text LIKE '%string%'

Can anyone tell me why no indexes are being used in this? http://pastie.caboo.se/84183

old_text is a mediumblob - and it was case sensitive

i don't know ….. try fulltext indexes

iratik, it's f/ MediaWiki / boxed. ;-) tryin not to go all reindexing fancy on them

so I have 10 processes each using 108MB of ram, how do I get that down to fewer processes ?

the instr(mediumblobfield,'string') method is case sensitive. :-(
I even tried LCASE(medblobfield) - no dice.
or another Idea I had was the REGEX matching - is there a way to specify a REGEX pattern as case-insensitivei n MySQL?

!man pcre

Sorry - I have no idea what function you're talking about! but try http://dev.mysql.com/pcre

shoot

SELECT DISTINCT `B`.`friend_id` as `id`
How can I add the values of `A`.`friend_id` to the column `id` ?

High_Akujin, both number fields?

yes both are ints
they are origionally the same column technically

you want to add them mathematically in the output?
like… with a plus? ;-)

No, I would like to merge them
Imagine them as two arrays

how can I now how many inserts I have per day? in the whole DB?
I mean use something like show….

with a current value in id that you want to maintain?

show status

12«11threnody12» I don't really understand that question.

any resolution to Too many keys specified. Max 32 keys allowed

update table set id = concat(id, friend_id) where …

it occurs when i perform INNER JOIN
anyway around it?
different type of join maybe?

Anyone know how to do a case-insensitive substring search on a mediumblob field?

No I'm simply grabbing all the Friends of Friends of user X in a very simple table
to achieve that I do a query for all the friends of the user X and then I do INNER JOIN on the result doing the same exact query to grab all their friends
the problem is the result set needs to contain all your Friends AND Friends of Friends
if there happens to be a friend who isn't another one of your friend's Friend then they don't get put in the result
so……..
I need A.friend_id combined with B.friend_id into one column
then i use DISTINCT
I would like to achieve this with one query and not have to have an extra query for php webhosting to work with

you need to do a full (cartesian) join then

it sounds like you've taken more time finding the answer in mysql hosting than just implementing it in php

It has to be efficient, I don't want to put more load on mySQL then I have to

and you think running a full cartesian join instead of two small ph pqueries is *more efficient* ?
buh

I don't really know what a full cartesian join is…..
But I would like to learn if you have some reading material?

a huge advantage of using php is that you control the queries
!man full join

Sorry - I have no idea what function you're talking about! but try http://dev.mysql.com/full join

!man join

see http://dev.mysql.com/doc/refman/5.0/en/join.html

it can take some rerading to understand the differences, but you should be able to see that a full backreference (generating 1 x N x N results) needs a full join
full join all friend_id's on all id's and then select distinct on one id - it's a relatively simple query, but rather expensive to run

It seems rather weird that it's not possible to simply combine the already created result of two columns…….

the result is not two columns - it cannot be
if you're doing this with one table, by the way - good luck !

lol thanks

friends has to be a cross (or reference) table linked to people ids for this to work *at all* in SQL

ftp://akujin.mine.nu/friends.sql
here's the query
or what i have now atleast

that's not too interesting - what's the *data* look like ?
inner join ain't gonna cut it here, since you will only get full matches on the first ID from the second table - i.e. his friends

ftp://akujin.mine.nu/fof.png - some data

huh ? how about show create table for any tables involved ?

Is replication for the entire MySQL instance, per database, per table?

on a mysql master you can execute the command SHOW BINARY LOGS to have it assert the file sizes of binary logs on disk. I'm wondering how I can do this operation for relay logs on a slave. Anyone know?

just look in the file system?

that screenshot enough or you still want a create query?

High_Akujin what I thought - full join it is

wow, ftp links are awesome in kirc. i just opens the file in the associated application. i imagine that's a security risk, however.

that relates all freinds of X back to their friends, so you get a user * friends * friends join

yes, I can do that… but in order for me to be flexible I have to open and parse the mysql config file to find the location of those files

/var/lib/mysql in all intances ive seen.

unless there's a way to query for the location of those files from within mysql

Is replication for the entire php mysql web hosting instance, per database, per table?

well, in my setups I put my relaylogs in /mounts/mysql/[mysql instance name]/relaylogs

i'm pretty sure mysql has something for this (specifically mysl 4.2.1), but to be sure, is it possible to specify a start and ending row in sql, like return resulting rows 30-45

you can include/exclude specific dbs and tables
there's even a wildcard thing for the tables
at least, that's how it is in 5, I don't know what 4 lacks, or what new there is beyond v5

High_Akujin the table itself is already the user * friends "join" (as a crosstable), so all you need is the selected friends as users in the join, yielding all "friends of friends" for all users, and then select DISTINCT WHERE userid = "billyjoebob"

is replication setup from the mysql CLI or in the my.conf ?

but as already stated, it's incredibly expensive when compared to two separate queries

maybe you dont have to open and parse the conf file, .. cant you just run a query to get the mysql conf options?

lol wow
that would be fairly rediculous

datadir

how do i reduce the number of processes that mysql has running ? I currently have 10 processes running, I'd like to get it down to 5 if I could since it's only a test server hosting and I'm the only one connecting to it

again though i gotta complain, the damn column i want is being used in the join anyway, how the hell is it that i can't simply get that result set too without all this fuss

show variables;
show variables WHERE Variable_name='datadir';

your comment 4 ago was precisely what I suggested, I was wondering how I could do that

i see

I have relay_log = /mounts/mysql/shego-slave/relaylogs/mysql-relay.log, yet SHOW variables doesn't seem to have it in the list

mysql 5 ?

yeah
5.0.41 if my memory serves me
yeah

i dont see it either

well this is hilarious

I asked a question in the PHP room, the suggested I come in here and enquire about "views"
I wish to take the results of 3 queries, and place them into a table, so that I can select distinct from the final table

Billium, look at create view

the column B from table C with id = 1?

what kind of join do i use? do i put the conditions in the on clause or in where?

c.b and id = '1' ?

so i don't use a join?
sweet

that's an implicit join.
but yes

'…a,c..' == '…a inner join c…'

I am looking at the create view, that seems to be ok, for a 1 query result set. I wish to use 3 queries, and place the results of all three into the same table.. using a temp table perhaps? and an insert? then I can select distinct record from that temp table
or maybe an array?

hello everyone, just a quick question, it i were to perform a search for an occurance of a word within a varchar field that contains around 150 words, would i be best off using a FULLTEXT search ?

good evening

Hey guys I've got a collation error here,
Illegal mix of collations (utf8_general_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation 'UNION'
Please don't tell me to upgrade I'm running 5.0.19 on this server.

I try to recover a inno database (5.0) without the main tablespace, mysql was configured with the option innodb_file_per_table, so I have all the files of the database, but now I am unable to access the tables (table not found).

I just dumped a customers database converted it to utf8 recreated and reimported the sucker, now the customer is getting an exception on their website due to this.

shocking

I'm at a loss here.

can someone point my to some documentation, how to recover from this situation
anyone a idea?

hi all!

Hi one!

what's up the_wench !
anybody know about mysql HA?
anybody know about mysql High Availability or mysql master-slave?

http://rafb.net/p/tt6WyP61.html
I would really appreciate some help

labuser, I'm sorry about your problem i don't know

:/

labuser, but i answer you very fast or not?

I have a procedure that insert a row to a table with auto_increment. I tried to set autocommit=0; start transaction; call my_procedure(…); rollback; a few times, and it seems like nothing is written to the database, but the id increases
is this how it's supposed to be, or am I doing something wrong?
ok, according to http://lists.mysql.com/mysql/178603 that's how it's supposed to be

what specifically do you need to know?

hi all, im returning some values from a query - the value of one field is CONCAT(table.field,'/', table.field) - this is in the actual table as a row. When it returns this, is it possible to get it to parse it as part of the query?

"parse it as part of the query"?

well it returns the above as data in a row, but obviously i want it to return value/value instead of CONCAT(field,'/',field)

I'm still confused… you don't want it CONCATed?

FOREIGN KEY (nid) REFERENCES news(id) ON DELETE CASCADE, in a create database, what does it mean?

what is wrong with this query? echo '$_POST['email']' $_POST['password']';

No i want it to

that's not a query.

but im not entering that in the query, its returning that as data from the table

Examples?

sorry, I meant code

##php?

perhaps the question is better suited for ##php

gotcha…thanks

In the row i have the following, id: 1, attribute: 'speed', value: CONCAT(user.up,'/',user.down)

oh
Dynamic SQL. I don't think you can do that, and it's VERY dangerous.

hm

how can it be dangerous if you can't do it?

does mysql not support a FULLTEXT index on text type data fields? it is searching every field i have specified using MATCH() except is does not seem to be searching the TEXT type field i have in my table
is there some quirck im missing? like it only indexes text types if…

I believe SQL Server can do it…
It cant
haha
It can…
No idea where that 't' came from

uhmm yeah.. it does support a fulltext index..
read..

I was finger happy

no, thumbs happy
that would be the second time you do that to me…

i have, read 4 tuts on it, i just keep thinking im missing some quirck as i have done everything exactly, and it works for every field but the text type field, strange

You must like it. You never said stop

you're right!

Hitting the 50% mark?

anyway

50 mark ?
*50%

50% threshold

nope, not even only 2 rows i am querying, and both are 100% unique, even made both entries longer than 3 words so they will be indexed

There are only 2 rows?

heh well for right now, there will be thousands later on, im just trying to get this set up and havent entered a bunch of test data yet

50% threshhold…

DELETE * FROM mac WHERE address = (’alias@domain.tld’);

is it 50% or =50%

is that wrong?

50%

i see the table in there..

!m `mac` delete syn

`mac` see http://dev.mysql.com/doc/refman/5.0/en/delete.html

thank you

Why did you put ( ) ?

right, so then if my rows are 100% unique, then it should be returning a row

Insert one more row

the example said it like that seekwill

I don't see an example…

not on that page

What page?

i m using freebsd; and i m following this page..
kewl it worked

how can i tell DISTINCT to only look at one column instead of all of them

DISTINCT applies to every selected column.

ok but is it possible to do what i just said?

perhaps you want to use GROUP BY instead

don't help me

!man grouping

see http://dev.mysql.com/doc/refman/5.0/en/operator-precedence.html

!man group

see http://dev.mysql.com/doc/refman/5.0/en/group-by-hidden-fields.html
see a href="http://dev.mysql.com/doc/refman/5.0/en/group-by-hidden-fields.html"http://dev.mysql.com/doc/refman/5.0/en/group-by-hidden-fields.html/a
see a href="a href="http://dev.mysql.com/doc/refman/5.0/en/group-by-hidden-fields.html"http://dev.mysql.com/doc/refman/5.0/en/group-by-hidden-fields.html/a"http://dev.mysql.com/doc/refman/5.0/en/group-by-hidden-fields.html"http://dev.mysql.com/doc/refman/5.0/en/group-by-hidden-fields.html/a/a

If you have two rows, A and B. You want DISTINCT A, but B has different values, which value do you want?

hey! give it back

A DISTINCT with the first possible value of B
but w/e
i know it's impossible
or annoying to do

Define "first"

"first"

Well A is just an INT and B is a timestamp

I'm having a really dumb problem with getting mysql up and running…

Which timestamp do you want?
Don't say any…

there's only one so….

There is not only one.. if there is only one, DISTINCT would work
uThere is not only one.. if there is only one, DISTINCT would work/u
And you wouldn't be here

it's my first look at sql.. anyhow, I have installed (from repositories) mysql-client and mysql-server, but it won't let me access the administrator thing.

He specifically said "DO NOT HELP ME"

$ mysqladmin -u root password mysqldata
connect to server at 'localhost' failed
'Access denied for user 'root'@'localhost' (using password: NO)'

owm-seabrok: maybe you already set a root passwd?

chadmaynard no, this was happening right off the bat

owm-seabrok: do 'mysql -uroot -p'

does anyone know if binlog replay on 5.1 shows the proper binlog positions after a crash and restart?
innodb related, I mean
in 5.0 it just shows 0 173 as the position all the time

$ mysql -uroot -p
Enter password:
Access denied for user 'root'@'localhost' (using password: YES)

reset root

See http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html

If I import a mysql backup

owm-seabrok: ^^^ that's for you

will do, thanks!

do I need to have 2 times the size of the backup in free HD space?

I am trying to do a database of credit card transactions. They have an unsigned integer id, that is 23 digits long. For example: 24445007211915555639550, this is too long for a big int. whose maximum value is 18446744073709551615. Who would you guys store this integer
?

if my query is $query = 'SELECT email, password FROM users'; how do I echo the email addy?

you use php. And ##php

perhaps as a decimal with 24 digits?
or maybe a string?

if I was asked to decide, I'd try to pack it into a binary structure of just the right width
I know there is redundant/checksum information buried inside cc numbers, and I'd try to remove it and store only what I need

hmmmmmmm

get on with it

|

just use strings
IMO thats an excessive length

encrypted strings

and i used to work at a credit bureau

Is it really that bad to store one or two extra characters?

base64 encode it. That'll fool them!

or generate a new id to map to the long one
and then send them back the new id with the mapping file

ye, I willl just use strings, that is the most portable way
I have to read this stuff into other languages
and print it and sort it and stuff
lol @ Julian yes that would

seekwill - achieved what i wanted to do with multiple subqueries and UNION

How?

with multiple subqueries and UNION

yes, you said that already

(select id, username, 'some_attr' as attribute, CONCAT(val,'/',val) as value FROM table) UNION (select etc)
and so on

huh?

hi all!

Hi one!

I must have misunderstood your question

hi all! I got some newbie questions
can anyone help me out n_n?

not if you don't ask your question

xD okey
i just installed ubuntu, mysql and mysql admin, i wanna know, how to add services, users and tables? for some reason it wont do the work nor display the function

hello

its ok - it took me a while to get my head around it - i was trying to retrieve 4 unique rows of data, by using a single query - so I can send the proper accept packet via freeradius

once again, you need to formulate a clear question.

im sorry for my english, im good but not that much… so basically I just want to add services using MySQL Admin, since im going to start setting up the gaming server.

add … services?
what kind of services, exactly?

mmm not a service im sorry, a new database

!man create database

see http://dev.mysql.com/doc/refman/5.0/en/create-database.html

you should use the mysql console instead, and read that man page

what is your native language?

mine? Spanish o

me hablas espanol

haha
obviously, thumbs

well, enough to get around
chadmaynard–

lol "me hablas"

hey I make my own sentences

does someone feel like helping me with (what i thought should be) a simple query?

me isn't even a spanish word

I know that, obviously.
you should try asking your question.

asko el questiono

wrong person : )

lol

ok then
hablo un poco espanol

ok… well, im trying to inner join 4 tables and COUNT() 3 fields

muy un pococito

count the fields? # of rows * 3

it'll work with just one COUNT(), but when i try to count another field from another table, the resulting data is incorrect
well, i want like… clients.id, count(referrer.id), count(autos.id), etc

you are also grouping, correct?

yeah, i have a GROUP BY clients.id

offer him 5 pesos to show you the query.

haha

demostrarme la pregunta por favor

ok, want me to send u the query?

what about the pesos??

uso el pastebin, por favor

in here or in a pm?

RyukZilla is the Spanish speaker.

deseas tener cinco pesos

oops

Isn't there an #mysql.es

hey, I was practicing my spanish

!manes select

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 3

vea http://dev.mysql.com/doc/refman/5.0/es/select.html

pastebin isn't in /topic

I'm just trying to create a table and put 1 field in

good evening everyone

try pastebin.ca

I'm in trouble
http://pastebin.com/d109f139

ok?
ok

nvm got it

and yes, my spanish *is* terrible

the only thing I change it's the ID and there's TWO different explain..
haha

i f u

and f u i on the first one

apparently, it was good enough for p_orange. He understood it

it's really strange

\o/

I don't understand why it's not getting the same order/ number of rows

ok. here ya go: http://pastebin.com/m79665a4d

are you trying to understand the optimizer?

awesome site btw

i'm trying to understand why my query is slow :|

that query looks sane. How are the results not satisfactory, exactly?

i see

do you have a clue chadmaynard ?

the data is incorrect

looks like it'd be quick from the explain. How slow?

show me how. Show me data how it should be and how it's really returned.

explain is always quick ! Slow like about 3 sec
sometimes 5sec

im sure left joins have lots to do with it

id=6 : #3 sec and id=530 : #5sec
i have to deal with INNER JOIN ?

well, explain should run under a second, regardless

If I have too much idx on a table can it slows the table ?

thumbs… ok, gimmie a sec

Are there any fixes in the mysql-proxy trunk regarding 'lost connection (..) reading initial communcation packet' errors?

indexes makes the insert/update slower and disk usage higher, but it shouldn't slow down the rest

and if I shouldn't use LEFT JOIN, what i must use ?
ok thanks

well im not saying you shouldn't use left join but if you are and you aren't using it correctly the result set can grow exponentially

okay. But what's the good use ? Because my query is really simple

why did you pick the type of join that you did?

because I have to mix up all the data and the only way for me is LEFT JOIN.
I have to select all the i.id by comparing 2 dates on 2 tables

you want this data in a pm thumbs?

I think he wants you to paste it in the channel

join.intcol1 AND intcol join.intcol2"

ok, i'll give it a shot
Client Name | c_id | cars_sold | total_members
lujack | 1 | 55 | 55 |
test dealer | 2 | 2 | 2 |
Client Name | c_id | cars_sold | total_members
lujack | 1 | 11 | 8 |
test dealer | 2 | 2 | 1 |

Why do you think MySQL cannot optimize it?

i guess irc recognizes "//"

Try a pastebin then

explain in the BETWEEN case shows join type of range est. rows of 4 where it is join type ALL est. rows of 62 (number of rows in table)
i should be add that i'm self joining here

http://pastebin.com/d54a82588

What happens when you run both queries?
Any real-world perf diff?

probably not right now, but if i'm doing ALL there would be once i get a bit of data in there

There have been times where EXPLAIN was wrong.
It only estimates what it thinks it will do.
Purple Otterpops melt slower!
I was wrong in my physics somehow

how much slower?
I think you are just being ridiculous

25%

no way

It has been consistent over two trials.

stop breathing on the red ones

Silly, I don't do that. That would obviously change the defrost rate. I just hold the red ones.

lol

is there a good way to clear the query cache on just one query/table?
(on myisam)

anybody knows how to configure a mysql-replicate-client to start auto. the slavemode after a server reboot?
evertimes i reboot the slave he tells me that he doesnt find the binlog

how can I get to the Mysql console?

I am getting a syntax error when trying to run a subquery. Any idea what the problem is?

hmm. in the nested sets system, does there always need to be a "root" of the tree? if not, how do i know if a given node is a top-level node or not?

SELECT ProductName, SupplierID,
FROM northwind.Products
WHERE northwind.Products
IN (SELECT SupplierID FROM northwind.Suppliers
WHERE CompanyName IN
('Exotic Liquids', 'Grandma Kelly''s Homestead',
'Tokyo Traders'));

use a pastebin please

I am a little dense. How do I do that?

your problem is that IN compares to a column not a table

Are you referring to the first IN?

y

can someone take a look at this query for me por favor? http://pastebin.com/d14503c88

How would you change it?

how can I get to the Mysql console?

run mysql from an ssh/terminal session

okey

was that a serious question?

it says access denied and ye.. am a newbie so u can laugh about it

If c_id is the primary key for clients, the SQL seems reasonable. To explain the behavior, I'd need the data as well.
One possible answer is you aren't planning for the effect of N-M or several 1-N relationships.
One possible answer is you aren't planning for the effect of N-M or several 1-N relationships.
Try this change… COUNT(distinct autos.id) AS cars_sold, COUNT(distinct referrer.r_id) AS total_members

Xgc _ can u help me?

type mysql and press the enter key

Just a guess. Without knowing your data, I can't tell if that is correct.

it says "access denied for user xxxxxxxxx@xxxxxxxxx (using password: 'NO')"

mysql -uroot

i'll give that a shot Xgc

same error

The other approach is to use derived tables to provide the counts for autos and referrers per client.

are derived tables like stored procedures?
like, predetermined queries?
or someothing

Same error !

No. They are subqueries used on the FROM clause.

oh… ok, i heard that subqueries are not as good of an approach to most things as JOINS
oh S&*! that distinct worked!

*nod* You're welcome.

you think i might not have formatted my tables well?
i THOUGHT my stuff was properly normalized

This isn't an indication of a normalization issue. But I haven't lokoed at your schema. This is a simple JOIN misunderstanding. Here's the derived table form of the solution: http://rafb.net/p/ao2R5646.html
I did the best I could without having the schema to test against. I may have typos in that.
It also wasn't clear to me that a referrer match is guaranteed for each client.
So I used a LEFT JOIN.

Any idea what I am doing wrong here http://pastebin.com/d2bd03c9b ?

is ) a special character that has to be escaped?

you referring to me?

No.
The first thing you did wrong was you forgot to ask a clear question. What behavior dno't you like? What error did you see?

I don't think so. But I am a newbie. Only thing that I know has to be escaped it the apostrophe

Single and double quotes are special.

I am getting a syntax error. It says you have an error in yoru SQL syntax; check the manual that corresponds to yoru MySQL server version for the right syntax to use near 'ProductID' FROM northwind.Products WHERE SupplierID IN (SELECT SupplierID 'at line 1

Not possible.
Post the exact SQL and the exact error. Copy/paste. Don't retype it.
The SQL you posted can't produce that error.

The error message is posted here http://pastebin.com/m5c2a0d65

Now post the real/exact SQL.
The SQL you posted did not produce that error.

hi
guys, tell me how I can change a table field definition

I figured out the problem. It was an unneeded comma at the very end of the first line. It now works.

ALTER TABLE …;

Hello. May I know is there a function I can do on MySQL to monitor if there are any queries that are being executed for longer than it should be?

thanks Xgc

I would love to have that monitoring so that I can optimize my app.

See: Slow query log.

hello someone in ##php told me to ask here for help on how to grant my user access using GRANT
how would I do that

Xgc, cool. But may I know where the log is?

I think I will learn MySQL again

http://dev.mysql.com/doc/refman/5.0/en/grant.html

thanks

Xgc, found it. thanks

You have to enable it. The location is configurable. Could be in /var/log/mysql or the mysql datadir.

Thanks Xgc.

is there any way I can list all the users on my SQL server
with a query or with phpmyadmin

Hello all

I'm using PHP to upload values such as '0255' to a mysql database into an value in the table. But, the info only comes through as 255. How do I make it keep the 0?

You shouldn't let people stand on your server.

?
i dont understand

Do you want those connected or users that have been granted access?

granted access
i want to be able to view all the names of the users

SELECT * FROM mysql.user;

oh

SELECT user FROM mysql.user;

#1142 - SELECT command denied to user 'rave_'@'mysqladmin2.secureserver.net' for table 'user'

Find a better user that has access to that information.

the only user
darn
oh its because my webhost uses one server to manage all the users

anyone here an expert at creating queries that utilize index optimally

(not a dedicated server)
hope that doesn't affect me in the future

You're in the right place. 428 people. Many mysql developers/employees and other experts. Just ask and hope someone can offer advice.

xgc I have a site that is basically on its knees at least twice a day now.

oreonix are you sure the db is the bottlekneck?

ChrisPartridge, it feels like it
23 queries per second
when i type status in the console
i have a data table with a little over 2 million rows in it
and I dont think my indexes are doing anything for me
data_id | dtstamp | listeners | song | stream_id | is my structure
actually
let me put this in paste bin
brb

!man create table

see http://dev.mysql.com/doc/refman/5.0/en/create-table.html

http://www.pastebin.ca/642609

hehe. http://dev.mysql.com/doc/ has broken links to the documentation….

I am not if my index helps at all

Which links are broken?

the ones that are the html online

sure8
sure*
man i am having problems typing tonight
:-D

they show up as https://docsrva.mysql.com/docs-translations/en/refman-5.0/html/manual.html here
^^

hmm

So I have 16GB of RAM on this Sun Fire 4600. And I've given MySQL really high settings for key_buffer, sort buffers, etc.
But when I run top, MySQL shows only a few hundred megabytes being used, and most of the memory is coming in the VIRT column
the real mem is like 650M, and VIRT is 2900M

dont set key_buffer higher than 4G (4096MB)

does that mean MySQL is swapping out of disk?
key_buffer is like 2GB

im not positive but i think if the ram isnt actually used yet linux wont actually allocate it out of real memory, i've noticed that before, feel free to look into that properly.
so it show sup as virt
but thats a mostly guess from me

wonder how you can find out if your programming is being swapped to disk

does "free" show swap being used? ?

yeah a bit
28228
Around 27M
So I configured top to show SWAP, and it shows a 2.2GB SWAP

interesing. mine shows 1G
(yet i've only got 2M swap used)

boohoo, see how many blocks are used versus not used.. show global status like 'key%';

83240 vs. not used : 1631496

so it's saying it aint really using all your blocks anyways, lower the key_buffer_size variable and increase other ones
I've noticed that too about my key_buffer_size, rarely ever uses the full amount
or even 1/2
maybe cause it's accessing so many different tables and only caches what it decides will be used in the future.. who knows

I wonder if it'll help to increase the query_cache_size to like say 4GB

boohoo, don't!
each update will invalidate all those queries… heh

k, any reason why?
hmmm…. well it's mostly static

someone wrote about a bug with query cache recently anyways .. i can't remember what it was but it was just like 1-2 nights ago i read it
if it's mostly static, do like 128MB
and then monitor how much is used vs how much is free.. and then increase it if you need oto
too

hmmm yeah i guess no point wasting it

boohoo, for me .. I'll use a lot of memory tables .. mysql will show like 1.8GB of ram used but really it's not…

At this point I'm repairing tables worth 23.1GB

also I run with swapiness at like 10
ohh.. myisam_key_buffer_size=1800*1024*1024;
is it 32 or 64?
err.. is it myisam_sort_file_size…
one of those … will help with fixing the tables

myisam_key_buffer_size=1800*1024*1024 ? is that KB?

Hello, while EXPLAIN shows how a statement is process, may I know how can I know the time it takes to process a statement?
a query, i mean

buffer_size is like 128M for me

boohoo, sec lemme see which it is
set global myisam_sort_buffer_size = 1800MB ;
it won't recognize the MB .. so you gotta do :
set global myisam_sort_buffer_size = 1800 * 1024 *1024;
reconnect, repair table
should go faster
there may be a few more variables that help but myisam_sort_buffer_size helps bigtime

shit, 1800MB?

May I know what is the best way to index a DATETIME column?
I tried indexing it but the query still doesn't use it

uzyn, read the part of the manual that says "how mysql uses indexes"
that may reveal the solution … I don't know offhand tho

ok Tapout. thanks

uzyn, you get the time of the query at the end of the execution.. that's the only way

got it. thanks Tapout.
i thought there's an easier way by using some built-in mysql timer or something

myisam_sort_buffer_size should be like in two digits of Memory

why?

well I wonder what 1800MB will achieve
1800MB per thread?

Hello friends
Y need some help

whoever broke the mysql.com/doc … forcing it to go to the intranet site.. fix it pls
boohoo, hopefully this pastes properly
myisam_sort_buffer_size
The size of the buffer that is allocated when sorting MyISAM indexes during a REPAIR TABLE or when creating indexes with CREATE INDEX or ALTER TABLE.
http://forums.devshed.com/mysql-help-4/slow-to-add-an-index-186951.html

Friends i need your help urgent please :'(

uggh.. your urgent isn't anybody elses
just ask your question

Thanks
Modifing my file my.cnf
Y modify the size of the Innodb log file
When i did that my tables where corrupted
A messages of erroneous data in .frm files appear
I go to the help in http://dev.mysql.com/doc/mysql/en/repair.html
Creating a new BD with the exact tables schema of my corrupted tables

you're right

But my .MYD files are deleted
Is there any possibility to restore my information
?

no
if you hav myisam tables and deleted the .myd your data was deleted
if innodb then you don't have .myd

The engine is Innodb
But when i follow the procedure moving the new .frm and .MYI files to the old ones and execute an REPAIR TABLE and follow an SELECT
The table is empty

innodb stores data in ibdata files

CREATE TABLE wil_aliases (
alias_idnr bigint(21) NOT NULL auto_increment,
alias varchar(100) NOT NULL default '',
deliver_to varchar(250) NOT NULL default '',
client_idnr bigint(21) NOT NULL default '0',
PRIMARY KEY (alias_idnr),
INDEX alias_index (alias),
INDEX client_idnr_index (client_idnr)
) ENGINE InnoDB DEFAULT CHARSET=utf8;
This is the SQL CREATE of my tables

plz, use pastebin
:P

Any suggestion?

i know this is kind of a stupid question, but is there a way to control what number an auto-incremented field starts with?

yep
ALTER TABLE t2 AUTO_INCREMENT = value;

oh
does that effect performance at all starting with a larger index?

no

sounds cool to me

you can do the same with CREATE TABLE. It goes at the end with ENGINE IIRC

oh
thanks for the help chadmaynard

Hi Greetings!
If i take the backup of .frm, .MYD and .MYI … will I be able to restore it to the DB or tables later ?

Friends thanks a lot
"Googling" i found the solution
And is more easy that i think

yes assuming you lock everything or stop the mysqld process while you copy the backup files

Thanks

yeah I lock all the tables and once copying is done I unlock

sure then

thank you )
*wrong smiley forgive me for that!

lol

Possibly stupid question, how can I insert an .sql file into a running database?

what OS?

Debian Etch.

cartesian mysql -uUSERNAME [-pPASSWORD] DATABASE_NAME /path/to/sql/file.sql

Thank you.
hmm, I'm not sure if openvcpd wants me to make the database or no. How would I make the database first and set a password?

CREATE DATABASE name;

Heh, thanks.

GRANT ALL PRIVILEGES ON dbname.* TO 'username'@'localhost' IDENTIFIED BY 'password';

funny thing…
Lost connection and the transaction is committed anyways

nils_ you must have 5.0.2_magic

indeed
only that it is 4.1.11

hey all… hopefully a real quick one, im looking for a client application i can run here to edit my servers mysql database direct.. any bright ideas?
windows, preferably open source

sqlyog
not opensource maybe, but free

good enough i suppose
im unlikely to actually change anything in the source, i just like to use OS where possible
wow.. this thing looks like a way bigger hammer than i was expecting

that's what she said!

Anyone who consults or whatever. What do you use to generate invoices? Any decent tools/web apps out there?

I use to con people, and I use to insult people, but not in combination

invoices? quickbooks
nils_++
good humor there

for the 1 to 10 invoices a month I use openoffice
especially for the small business there doesn't seem to be any software which makes life easier

hmmm.

hmm I think it's time to switch to mysql 5 soon

I've never used it, but I know MS is offering Microsoft Accounting Express 2007 - http://office.microsoft.com/en-us/accountingexpress/FX101729681033.aspx

I thought Microsoft only builds Mouses and Keyboards?
alright, that was pretty dumb. Just ghosted myself.

Is there a way to get the category ID to show up in the search? Right now only the company name and supplier ID are showing up. http://pastebin.com/d7f1b5f7a

is there a way to make an INSERT statement return a value? specifically, the index of the row inserted?

you need to read up on mysql_insert_id() - http://dev.mysql.com/doc/refman/5.1/en/mysql-insert-id.html

k, will do
also, is there a seperate way to do it using "last_insert_id" or something?

select last_insert_id();

well, that's easy enough

can anyone here help me figure out how to set up mysqld to accept connections from another computer?

is there any reason why my program would work on xp but when i run it on vista i get sql connection problems?

!tell mvfeinstein about external

mvfeinstein remove bind-address= and skip-networking from my.cnf and grant permission to the external 'user'@'host' and remove any firewall rules blocking port 3306 and make sure no overrides on the mysqld commandline

Usually you get an error message…

ye its just an error message that ilooked up and means LoAdS of things, Unexpected Connection Termination

is it possible to perform an ALTER table statement to add column only if that column doesnte xist

And what program are you running?

myslq

one i made in c#, it looked up a table and selects a few things, nothing complicated

mysql

seekwill did that already

That is all you need.
If you wrote the program, you need to add better debugging messages to your app

seekwill ok but its still not working

You didn't do everything then

seekwill ive debuged it and ive found what causes the error but thats what i dont understand, its a simple SELECT * FROM tbl_a WHERE x = 1 sort of thing nothing complicated at all, why would that cause an unexpected connection termination only on vista?

It's Vista…
??

I checked my.cnf and neither one of those things are one there i added a rule to iptables on the server to allow port 3306 and restarted it then I grated premissions in mysql but when I try to conect I still get an access denied error

What is the exact error?

Access denied for user

I'm sure it says more than that.

'root'@'10.10.10.12' (using password: YES)

Why is it so hard to get info from people wanting help?
How did you add that user?

here is the command I used to grant premissions grant all on *.* to 'root'@'10.10.10.12';

You didn't specify a password?
In that case, you shouldn't be specifying a password when trying to connect

seekwill good point lol

It could be something where the connector is not compatible with Vista…

damn it, i hate making stupid mistakes…. thank you for your help

See, if you didn't paste that last part you omitted before… never would have known!
That's why it's important when someone asks EXACT, you give EXACT and no modifications.

sorry I was just proof reading it to make sure there wasn't anything I shouldn't be pasting to irc in there

Not like you couldn't change a password or something
There's not much sensitive information you can paste.
A root login without a password perhaps…

I have been working for 12+ hours and typing so many connection strings with public IPs usernames and passwords I just didn't want to make the mistake
thanks again for your help

Hi every1!
How to get all categories to max. 2 depth in "nested sets"?

can you check if column exists in mysql 4

in mysql idoes subtraction have to be -= 1? when performing an update field = field + 1 works for addition, but field = field - 1 does not work
any ideas on what im doing wrong? im sure its something dumb im missing

hi, can somone tell me why this doesnt work please? http://rafb.net/p/cJBReA34.html

seems like there is something wrong with your code or your server.
or compiler
or operating system, or vm

thats very specific answer xD

lol
l
the problem is with the param, its not getting filled

how do i order by A, then order by B in a select?
instead of A, B
because A is DESC, B must be ASC

ORDER by a DESC,B ASC ?

aha

anyone awake?

nope

WHERE X=…?

better use an index

okay; i want to use nested sets and should "left" and "right" parameters be in one index?
WHERE left5 AND right6 ORDER BY left;

should be in one index.
have to read on that a bit range matches are difficult.

grr. /me can't figure out the math right on moving nodes in a nested set tree. does anyone know how to do this?
(i should add that i'd like to do it in one update)

hi
why is it tht i cant connect to a ms sql instance, but i can if there is no instance?

what do you mean ms sql?
how are you connect?

sorry
its not mysql… its ms sql

ok

you can call microsoft for support

heh
aight

lol

at least I hope so. You pay for it… Well for windows it's always "ask your hardware vendor" as most windows installs are OEM stuff but with SQL Server…

dunno… ive got 2 machines on a lan both with ms sql, on the 1 its set up with an instance, on the other not
i cant connect to the instance install
n i cant figure out y…

perhaps the MySQL channel isn't the place to ask for help wrt MSSQL

you are right

i know…

there might be some channels which are more windows specific, usually most MySQL users haven't touched SQL Server, only other unix based databases.
postgres is console only, no X involved

hehe

hmm and the postgres channel is not so bad after all, but it's some time ago since I used postgres

now hes gone /me admits to having mssql on a box to do a migration from

shame on you!

hehe. doesn't count though if you are migrating off it

I wish the migration toolkit didnt have silly install bugs though

i can't put an IF() inside a BETWEEN can i?

postgresql?

not that i can give an honest opinion, 99% of my experiences have been with mysql so far

I'd say it depends.

factors?

usually choice of RDBMS is given, you can't use postgresql like mysql and vice versa and expect one to perform better in all cases

yea thats a fair call
each has its plus sides

one example is subselects, postgresql optimizes them way better than mysql

mysql seems to focus quite a bit on performance in certain areas, whereas postgres focused more on raw functionality by comparing what each can do already, mysql is playing catchup there on functionality but i couldnt say whether postgres lacked on the performance side or not

but if you use mysql a lot you are used to that and use joins for most cases because a subselect isn't really needed (the infamous left outer join is an example)

I saw a nice barndoor security hole on pg

i guess considering mysql has had most of the functionality for a while now, theyve had time now to try perfect things performance wise
hehe

well postgresql aims for feature completeness and accordance to standards
with performance being a secondary goal

yea, completeness definitely
yep
vice versa on mysql you think?

yes

i tend to think mysql wants to add functionality but not at the cost of performance
thats what ive found
hence why its taken a little longer :P

well they do, but you can break standards accordance some times if you need performance, for example you won't need ACID for many applications

mmm yea

plug in engines is nice

is it good to run an internet ads agent?

gah damn rats
stupid food processing business next door to us, their infestation spread to us :P

I think most databases are equally usable, each has it's downsides which you should know and work around

just heard them rustling around in the ceiling a min ago
yea
agreed nils_

I personally don't beleive there is database abstraction at least from a performance or extendability viewpoint
If I decided years ago to use postgresql and perl instead of php and mysql I might as well be hanging out in their channels now

If I have lost /var/lib/mysql/ibdata1 but still have all the innodb files for my database in /var/lib/mysql/foo is there any way to recover database foo?

you have innodb_file_per_table?
I doubt there is a way to recover without the main datafile…

'fraid not

well then it's all gone

Comments

nils_ I used find to search for mysql_history and I got two separate files locate on the drive But when I go

!pastebin

http://pastebin.ca

ha

is this correct syntax?
http://pastebin.mysql-es.org/63

change that datetime to timestamp
and let it do the default by itself, i think it's CURRENT_TIMESTAMP, but definitely not NOW()

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2). This is mysql version 4.1.12. Does anyone know what the problem may be? I moved the datadir and restarted is all.

how do I cast that result as a column name

let it do the default by itself?

SELECT whatever(foo) AS someName;
rmodified TIMESTAMP NOT NULL,
it will assume the proper values for default and update behavior.

oh cool, didn't know it'd do that

found something called "partitioning" in 5.1 that seems to be what I'm looking for. Might have to wait a while

And the KEY(nid) is redundant; those values are already covered by your primary key.

snoyes, I've been googling everywhere as to where in my.cnf I need to put "expire_logs_days=7" and just keep getting all these messages about it not deleting the logs..

It would go somewhere in the [mysqld] section
You should read this, or you might wonder why that timestamp keeps changing every time you update a row: http://dev.mysql.com/doc/refman/5.0/en/timestamp.html

anyone?

do 'ps aux | grep mysqld' and confirm that the service is running

snoyes, it worked for me!! Wow.. I tested it in our dev, environment… and it worked great.

thanks for responding. I can connect as root just fine, any other user gives me the error message
got it, seems to have a permissions issue on the dir of the socks file
how that got altered is unclear

glad you found it

thanks for looking

i have two tables, one created to find dupes (but missing the id column of the first) I need to take the original table's id and that to the matching row of the first
update calls_temp set calls.id= calls.id where calls_temp.date_entered=calls.date_entered,…
er
calls_temp.id=calls.id
i'm not a sql oompah

php iterators are fany!

wtf

Pardon! please mind your Ps and Qs

if i do INSERT INTO table (field) values ('hello world');
how do i get the ID of the last insert?

autoincrement

http://hashmysql.org/index.php?title=Autoincrement_FAQ

LAST_INSERT_ID huh

yup

ok but i will be adding that ID to two mapping tables afterward
after I add the ID to the first mapping table, wont LAST_INSERT_ID() hold that value?

Does the mapping table have an auto_increment field of its own?

how would i get the LAST_INSERT_ID from my_original_table
no

Then it won't affect it.

ah excellent
for future scenario

put it in a user variable.

woudl there be a way around it if the mapping tables did have auto_increment?

SET @myId := LAST_INSERT_ID();
INSERT INTO t1 VALUES (@myId); INSERT INTO t2 VALUES (@myId);

very cool. thank you
is := a typo? or did you just want =?

!man :=

see http://dev.mysql.com/doc/refman/5.0/en/user-variables.html

It's a man with a mustache

can I evaluate column values, and use them in my query?
i have a column ANDOR
which will be either AND or OR

you are the php mysql web hosting genius
I can't even tell you how many quesions have you answered for me over the past year

I want to use "select * from table where (something) ANDOR (something)"

Whenever I see your name, I always pronounce it SNOW-YES, is that how it is supposed to be pronounced?

do i use a %d placeholder for a timestamp?

"filbert"

Use OR
OR handles the AND case as well.

well in some cases I want AND

You could build the sql string into a user variable, and then make a prepared statement out of it. Or you could do something like IF(field = 'AND', something AND something, something OR something)

and other cases I want or

Use AND in those cases.

I thought he meant he wanted to use AND or OR, and it's based off the value in another table.

I jest, of course. ess-noise

ok thatll work snoyes

In my head anyways

You can have more complex expressions based on values. You can use CASE / WHEN or other logic.

im n ur head

I dream about snoyes

is there a way to do a final ORDER BY on a GROUP_CONCAT line ?

stealin ur neurons
yes
http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat

Give an example of the logic you want to implement.

well a person can specify to use Day of Month and Day of Week
or Day of Month or Day of Week
so All Mondays, or only Mondays in the first 7 days of the month
that kind of logic

SnakeO; I get ERROR 1247 (42S22): Reference 'App_Var2' not supported (reference to group function)

heh

depends on the week

the answer is 12

42 ^ 0

according to the calendar there is only one, but it sometimes feels like at least 4

but you know

more, if there's no lasagna
Let's see the query

snoyes; SELECT USp_Sys_Transducers.id,USp_Sys_Transducers.item,USp_Sys_Prb_Type,Prb_Mftr,Prb_Model,Prb_Pict,Prb_Price_Vimg,transducer_types.Prb_Type_Name,Prb_Img_Freq_Range,Prb_Sz_Radius,Prb_Max_Depth,transducers.id,SUBSTRING_INDEX(GROUP_CONCAT(DISTINCT App_Var ORDER BY App_Var='App_Eq_Tendon'
DESC), ',', 1) AS App_Var2 FROM (devimaging.USp_Sys_Transducers,devimaging.transducers,devimaging.transducer_types) LEFT JOIN Prb_Application
snoyes; i am having a hard time with this query getting it how I want it. I am re-visiting it right now from this morning.

Where does app_var2 appear again in the query?

snoyes; app_var2 is from the substring_index line. i'm doing that AS App_Var2

Yeah, I see that.
But presumably it's in the WHERE clause or something. Move it to the HAVING clause.

herm
i'm new to HAVING…

It's just like WHERE, but is evaluated after grouping instead of before.

wow
but
i'm not touching App_Var2 in WHERE. I am touching it in SELECT and ORDER BY

hrm. pastebin it, and ask seekwill or someone to look at it. I'm off to get my face painted.

sounds pretty… gay?

thanks

making a 3-year-old laugh is never gay.

unless you're a Catholic priest.
lol

its a p'zone

anyone know if the mysql clustering management software is available for freebsd?

!man date-functions

Sorry - I have no idea what function you're talking about! but try http://dev.mysql.com/date-functions

!man date_format

see http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html

!man date functions

see http://dev.mysql.com/doc/refman/5.0/en/y2k-issues.html

!man interval

see http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html

!man date interval

Sorry - I have no idea what function you're talking about! but try http://dev.mysql.com/date interval

do you now?

Moin

moin moin

it's not possible to have an optional foreign key (not used if the field is NULL), is it?

A forgeign key points to a primary key, so it can't be NULL

how do you delete a stored procedure?

i guess the solution would be to make PK=0 for foreign key table..

DROP PROCEDURE …

ahhhh
duh

A child of five could understand this! Fetch me a child of five

I was doing DROP PROCDERUE name();
instead of name;
how can you edit your current STORED PROCEDURES ?

DROP PROCEDURE … ; CREATE PROCEDURE …. ;

?
there is no way that I can just edit them?
in vi or something of the sort?
or any text editor, or something besides DROPING/CREATING them again

no

ridiculous.

Create a text file that drops and then creates the routine

so how do you find out what the current SP is?

SHOW CREATE PROCEDURE
The MySQL Query Browser can help you with this

SHOW CREATE PROCEDURE; did not work.

It should

nm it does.
weird, what a crazy way to make them.

What error message you get?

that I'm stupid
I was doing `SHOW CREATE PROCEDURE` instead of `SHOW CREATE PROCEDURE name`
how would I call them within PHP?

same wax
way

hi all

hi

Hi, I am trying to have a query return the average for all items in a table where entry_id = $i … my query is not working, can someone assist?

paste the query and we can try

We are having a problem with 2 production boxes. BSD with mysql and imap running. Every 8 hrs it appears that mysql is falling over. I then need to restart th entire box. Any ideas please

thanks, but I just got it

so I have a field in a select query that I've aliased as "name", and I have another field called "name" in another table in that query… is there a way to distinguish the two besides renaming the alias?
like this_query.name or something like that?

hello
i have a table with eventid and companyid
i want to count how many instances of an eventid occur for each companyid
how do i write this statement

SELECT companyid, COUNT(eventid) FROM table GROUP BY companyid

if i have a database that is hosted on a server host on the inet, and the local inet link goes down, how do i keep the organization continuing to work?
is it possilbe to have a locally synced server that will switch over on loss of link, continue to provide database host funciotns and then switch back and sync back up upon reaquiring a inet link?

you should hav redundant ISPs if you need that type of functionality, i would think

in western kansas you have one ip choice only

http://pastebin.ca/643716
Is it possible to not get those duplicates, but still get same resultset(beside those doubles)

so … if your running a buisness with 10-20 people working on the same db and your db is hosted on the inet, and your isp link goes down, you suddenly have 10-20 people who can no longer work — send them home?

It's because of the last row (element_tag) I have no need for it, but need to at it, otherwise I won't get every element.
Hm, just thought that maybe left or right join would do some magic…

Good evening. I was woundering if someone could point me to some kind of manual or how to or something like that which actually shows how to make your sql host queries a bit safer? (if you understand what I mean)

SQL queries are sql aueries.
The foremost safety you build is to check the data that goes into your query.

Yeah but…if you like…don't "finish" it. It still works but it might get exploited.
Isn't that so?

What do you send the queries with?

Well I am doing some of the PHP stuff if that's what you mean

yup
the php web hosting mysql_query function can only do one query per time afaik

Correct

But what you could do is use the mysql_real_escape function or something like that.
It's on php.net's mysql section.

Oh, I know this function
Might be a good idea yeah
Thanks

Can't I do this query ?
"SELECT distinct REPLACE(REPLACE(tel_de,' ',''),'+','') as t, info FROM buchungsliste WHERE CHAR_LENGTH(t)=12
Unkown column 't' in 'where clause'

!update
!man update

see http://dev.mysql.com/doc/refman/5.0/en/update.html

allo
i've just installed mysql 5.0.43 via rpms via yum on centos, and it claims my error messages file has the wrong # of lines

hm is UPDATE suitable for changing a single value in some field?

anyone know which rpm package might contain the /usr/share/mysql stuff?

!man replace

see http://dev.mysql.com/doc/refman/5.0/en/replace.html

sure: update table set field=newvalue where ..

MarcWeber hm but i'm not wanting to update whole column, just a single value in some row

this is rather unfortuante, as mysqld wont start with this error msg file

where …

corp i'm sure you could find same stuff e.g. in debian .deb

I want to make a unique ID in my table, id of the first entry should be 1, of second 2 etc. how would I do that

MarcWeber oh hm

maybe the source dist is best

If you have an id it's easy.. if not you need a lot of fields listed

i have a unique name
UPDATE db.table set totaltime=12345 where name like "john"; ?

yes. But you should be using == if you don't want to have patterns .. In case of names like %..x you will get some surprises

hm :/

bhz-: keyword autoincrement field. Look it up in the manual. If you still need help ask again.

i have to be sure that it works just fine..
i also have a unique guid for that user

like "john%" will also match "johnX" .. that's why I would use = "john"

update db.table set totaltime=12345 where guid like 34;
hm i did use "john", didn't i?

Do you know the difference between like and = ?

not really
err i think i read you now…
like will be "john%" right?
johnx, johndoe etc.
so the key to success is where name = "john"; actually? that's what you meant
OR i will go by guid which is really unique in whole table, so where guid = "34";
is that fine?

is 5.0.46 available anywhere?

Query OK, 1 row affected (0.00 sec)
1 Changed: 1 Warnings: 0
wee

exactly

MarcWeber I got it thanks

Someone gave me a really good URL for a Mysql pastebin and I have lost it. Any suggestions?

I want to create multiple mysql queries from php. can I avoid calling mysql_query for each query?

I found the pastebin http://pastebin.com/

MarcWeber thank you!
Okee congrats mate

I guess I can create a string and seperate each query with ;, and then split it in a loop and pass it to myqsl_query? is there a better way?

hi guys

Hello. I'm trying to write a select statement that will return the "number of days ago", limited to all rows with 'date' less than 6 months ago. Any ideas?
((PERIOD_ADD(EXTRACT(YEAR_MONTH FROM CURDATE()),-6)*100)+1) but I can't really merge it with the 'days ago' part…

i'm triyng do it but appear error
alter table occabecera
renamecolumn c_oc_formpago c_oc_formapago char(10)
rename column c_oc_formpago c_oc_formapago char(10)

http://pastebin.com/d504f9be7 What am I doing wrong? My syntax error is http://pastebin.com/dab87937

2. Create a report that shows the total quantity of products (from the Order Details table) ordered. Only show records for products for which the quantity ordered is fewer than 200. The report should return the following 5 rows.

im trying to delete rows from multiple tables so i do http://mysql.pastebin.com/m3e536882 but it doesnt work, what am I doing wrong?

Hi anyone could help me with mysql?

depends on the question

SELECT X.*
FROM c_mod X, c_g_p P1;
X and P1 are tables and c_mod and c_g_p are columnames, right?

Can someone help me with the syntax for a RIGHT Join?

http://www.wellho.net/mouth/158_MySQL-LEFT-JOIN-and-RIGHT-JOIN-INNER-JOIN-and-OUTER-JOIN.html
there

no, in that syntax, c_mod and c_g_p would be table names, and X and P1 would be aliases for the table names

sorry im a real noob in this subject.. so what's a aliase for a table name?

So, X and P would be abbreviations of the tablenames that allow you to refer to tables with long names (in this case c_mod and c_g_p) without having to type the whole name

are there runtime stats kept on index use? got an existing db with a couple indexed columns that seem pointless, and I'd like to be able to confirm that the engine doesn't find them useful unexpectedly…

but then after that i have more reference to X and P with other tablenames

how do I calculate hit rate for MyISAM keycache ?

the thing is i have a code that used to work in 4.1.20 but it doesnt in 5.0.x
so im wondering if that's it.. if that's a syntax error for 5.0 and it's not allowed

try thinking about this: SELECT * FROM ThisIsAVeryLongTableNameToHaveToTypeLotsOfTimes AS atable WHERE atable.acolumn = 'whatever'
That would translate out to SELECT * FROM ThisIsAVeryLongTableNameToHaveToTypeLotsOfTimes AS atable WHERE ThisIsAVeryLongTableNameToHaveToTypeLotsOfTimes.acolumn = 'whatever
So, providing a table alias lets you use a shorter name for the table elsewhere in the sql statement.
You can have column aliases as well
Let's say you have a table with columns of Field1, Field2 and Field3
SELECT Field1 AS ProductSales FROM myproductsalestable

ah ok so that's definitelly not the source of the code not working from 4.1.20 to 5.0.. how do u recognize them? because it's a second parameter?
oh yeah but I dont have AS statements in the code

aliases? well, usually because there's an implied 'AS' clause between an *actual* name of a column or table, and the name you'd like to *use* throughout the statement.
no, the AS is implied in the version you provided. SELECT X.* FROM c_mod X, c_g_p P1; is exactly the same as SELECT X.* FROM c_mod AS X, c_g_p AS P1;

thoughtful, is this valid? P.group_id=" . session_get("group_id") . " I dont get those dots unless they're wildcards and i dont even have a session_get anywhere else and dont see it as being a built-in function

bhz- Not really. There is one extension which *should* allow this. I have already written what you want. Tell me if you want to have a look at it.

I need some help with my indexes
I have an index for datetime
that does not appear to be working with my query

that looks like PHP rather than SQL?

ahhhhh ok AS is implied.. so that's not the cause of my pain

in PHP the "." character is used for concatenating strings together.

Concatenation is very zen

Om Shanti on that one, seekwill

I am using a between statement in my query but, I am still getting results over 1 second

well hmmm it's inside a mySQL statement:
(SELECT blah blah WHERE blah blah AND P.group_id=" . session_get("group_id") . ") UNION (SELECT blah blah)

so, in the code someone is building a string in PHP that's going to be passed across to SQL.

If I use mysql from the bash command line, does mysql keep a log somewhere of what I typed??? I am trying to remember how I did a query a few nights ago and I'm drawing a blank…. hoping there is some sort of history kept…

is it possible to create an alias for whole mysql line?

~/.mysql_history

so i can just run foobar instead of typing a long query

nils_ THANK YOU!!! I'll check there….

you could create a view or write a stored procedure

nils_ hm

depends on what the sql is doing. you could create a view if its a selection, or a stored procedure if it's doing something else

!man write

see http://dev.mysql.com/doc/refman/5.0/en/mysql-install-db-problems.html

ok i see but according to what u're telling me then this code should work fine cause i dont see any problems related to the 2 versions… =(

i just need a simple select that i often use

create a view

and it's a pain to dig in history many times a day
!man view

see http://dev.mysql.com/doc/refman/5.0/en/view-restrictions.html

is this what i want to learn?

!man create view

see http://dev.mysql.com/doc/refman/5.0/en/create-view.html

also depends on where you're actually using it. if in a programming environment, you could probably create a global constant that contains your sql string and just use the constant wherever needed.

oh thank you!

you could also put the query in a text file which you load with the command line client (\. file)

and no, in this case i will just use it in mysql shell
hm..
but would i get output instantly in bash, too?

would be in the mysql shell

sorry I dont get it, if X is an aliase how'd the first X be computed from:

oh that you mean

SELECT X.*
FROM c_mod X, c_g_p P1;

bash would then be mysql [db] file.sql

i read you
thank you very much nils and thoughtful

because the parser checks the whole string before working out what refers to what

nils_ I used find to search for .mysql_history and I got two separate files locate on the drive. But when I go to look at them, they aren't in the folder. I"m still hazy with linux, but does this have to do with the period before the name, making it hidden?

I see… thanks

does 'query_cache_size=0' means it's disabled ?

yep
yes

so how can I look at them? I use nano…

1 is cache everything, 2 is cache on the demand

nils_ thanks

vi .mysql_history

if i give u a bit of the code would u be able to tell me what mite be wrong?

666 changes all your tables to blackhole storage engine

:-/

and finally 1337 enables full ansi compliance

nils_ can I copy the files to another to another file name and make those unhidden?

nils_ is it query_cache_type=1 or query_cache_size=1 ?

yes
both

nils_ how

just misread you, thought it was type
mv .mysql_history mysql_history

nils_ so query_cache_size=300M is valid ?

nils_ that's moving them though isn't it?

valid in my.cnf. You will still have to enable it I think
exactly. Move is just another word for rename in the Unix world

nils_ ok thanks

nils_ but if I move them does that screw up mysql, or will it just create new ones?

it will create a new one. You can create a link if you desire or copy the file.

kewl

3 AM… time for a steak

bone appetite

u there?

0 , query_cache_limit:31457280 ,query_cache_type: ON tells you

query cache won't be used.
0 bytes is not enough.

ok thanks

maybe experiment with query_cache_size a bit

goog good

I disabled the query cache altogether, didn't really help performance because of application level caches
a large query cache takes long to invalidate

i have to treat 4cpu box, that is maxed out

so as soon as your write count rises (independent of reads, this does not scale) query cache might actually hit performance

nils_ what constitues large qache ?

hmm
beyond 256M

ah I see

if your 4 cpu box is maxed out at cpu level you have the rare luxury case of a cpu bound workload

it's windows 2003 box with 2Gb ram

mysql + smp not good… windows and smp… well.
do you use myisam or innodb?

myisam
queries take 16 to 120 sec
mostly search

nils_ I looked at both of the logs and my commands that I was hoping to find aren't in there. How do logs work in mysql or in linux for that matter? IOW, what would cause a log to be overwritten, or when/how does a log get truncated or whatnot?

depending on the length. Are you sure you got the right file?
in your processlist, are there many processes in state "Locked"?
(mysql processlist)
also, windows and myisam is not a good solution because myisam relies on OS file cache heavily which windows doesn't offer afaik

aw

I proofed that by starting battlefield 2142, then quitting it, starting it again, took the same time to load, so no file cache

nils_ i don't have immediate access to the box, i'll take a look tomorrow

yeah
maybe innodb solves your problem

Nils_ yes, I can see many of the commands that I've typed in the past, recognize them, remember typign them in…. this will sound silly but I take ambien so that I can sleep, and so I have big-time amnesia…. often forget anything that happens 20 minutes after I take the pill….which will
come in very handy if I ever decide to murder someone, but I digress….

as soon as you have a considerable amount of writes (especially true for tables with many columns) myisam runs into locking problems

nils_ at any rate, this is why everything is so foggy as to what I did to create a specific join in mysql and was hoping to find it in the log….

you shouldn't use that stuff on a regular base hmm just to make sure, you did that join on the command line with your current user?

Nils_…. yep, I was logged in as root too
nIls_ I didn't mess anything up…. I just am trying to figure out how I performed a specific join statement of a couple of tables

you might also have a full query log, some mysql installation have that enabled by default

Nils_ I learned how to do the join (sort of) at a Foxpro users group…. and it was really cool… now I can't remember it.
nils_ Have you ever heard of doing a join… like this:
Nils_ you have a table with Customers and cust_id is the PK…

am I still there?

Nils_ then you have a table called shipments… which has addresses that packages were shipped to and also separate records with addresses of where the package came from…..
Nils_ and so you use a table alias so that you can retreive the shipper and receiver address on the same line using PK from the customer table which points to the fk's in the shipment table.
Nils_ did I lose you?

nope

nils_ are you thinking, or is my question a dumb or confusing one?

SELECT [fieldList] FROM shipments s INNER JOIN customers c1 ON c1.cust_id = shipment.shipper INNER JOIN costumercs c2 ON c2.cust_id = shipment.recipient
typing, cooking…

NILS_…. I THINK THAT IS IT!…
nils_ in your opinion is that an odd query? useful or no?
seekwill…. why?

SELECT *, ACOS( SIN( PI() * '38' / 180 ) * SIN( PI() * `Location`.`latitude` / 180 ) ) + ( COS( PI() * '38' / 180 ) * COS( PI() * `Location`.`latitude` / 180 ) * COS( PI() * `Location`.`longitude` / 180 - PI() * '-122' / 180 ) * 3963.191 ) AS `Location`.`distance` FROM `slugs` AS `Slug`,
`locations` AS `Location` WHERE `Location`.`id` = `Slug`.`location_id` HAVING `Location`.`distance` = '2

Try it, does it work for you?
!tell bikepilgrim about what's wrong

bikepilgrim Don't ask us "What's wrong with this query…". We are not SQL parsers. We do not care to look character by character looking for errors when MySQL will tell all of us WHERE the error is. Paste the FULL error issued by MySQL.

*sigh* IRC people

the key is to join the table twice

too much math?

heh

oh well

MySQL tells you exactly where the error is.
nils_:

I noticed thanks

SELECT [fieldList] FROM shipments s INNER JOIN customers c1 ON c1.cust_id = s.shipper INNER JOIN costumers c2 ON c2.cust_id = s.recipient

Nils_ YES!!!! that is EXACTLY the concept the guys was teaching at the users group….. it was really odd at first but very cool after I understood it…

I guess it's still wrong somewhere, but well that's how it works

Oh query has been fixed

pulling queries out of my ass after 24 hours awake most times ends in disaster

plus a mess

A smelly mess

indeed

StinkyQL

bikepilgrim maybe you can calculate PI() once and then use reference to it ?

nils_ were you say the query you gave me is wrong or were you referring to some other user here that you are conversing with?

same with english language, or the closest I can get to it

before I was intterupted I was going to say I get a syntax error near AS `Location`.`distance`

it's wrong and I also sort of converse with other users which know more about sql

is it not possible to select an expression AS a field of a table?

should an alias have a name like that?
alias

which alias, Location.distance?

the wench has let me down
I'm assuming the location.distance is a table.field?

no, it's the expression that preceeds the AS

Nils_ I know it can be done though because that was the whole concept the guy was trying to teach, using an alias so that you could do two joins against the same table and return the results back all on one line.

a big long expression that caclulates distance of the Location from another lat/long point
distance is just the calculated miles

bikepilgrim also there are geospatial functions in mysql

baloney. '.. AS `Location`.`distance`..'

yeah, that's why I did, but my actual implementation was wrong because I had a typo and missed the alias for shipments. but it's only an example so…

yes that's where the error is

good that I'll soon have my activerecord php implementation ready.

bikepilgrim, how should it read?

how should what read? the result?

no, the query

that's my question
i get a syntax error
right before I try to assign the distance calculation to the Location.distance alias

bikepilgrim, you are trying the query that I was asking Nils about,…. the double-join?
I feel like this is an abbot & costello routine… who's on first

no, I'm talking about my question

oh ok, sorry lol

:-)

* has no idea what French farce means

bikepilgrim
Distance(g1,g2)
Returns as a double-precision number the shortest distance between any two points in the two geometries.
bReturns as a double-precision number the shortest distance between any two points in the two geometries. /b

g1 and g2 being what?

(here we go again)

bikepilgrim rtfm

you are wearing a named pipe…
damn amateurs.

(I could have sworn I installed the server.)

time for great food ruined by bad cooking

I can't find much about using the MySQL geo functions, I don't know if my server even supports them
besides my problem isn't with calculating distace, that works just fine for me

salad and a baked potato, iced cantalope, fresh bread, glass of red wine. idjit proot.
proff*

nils_ get good wife to become good fat mysql expert

proof*

where's the meat?

only 1x per week sorry

same for salad with me

favorite vegetable — potato chips (crisps)
of course, that marinated flank steak grilled outdoors once a week gives me something to live for.

hehe
now that weigon is gone, any opinions on mysql proxy?

in my.cnf : which is correct key_buffer_size= or key_buffer= ?

hi. is varchar compisone in a WHERE term case sensitive?

key_buffer

*comparison

ajk^: depends on collation

thanks

UTF8

utf8_general_ci?

yup

ajk^: by default, ci. look at your collation

case insensitive

yeah _ci part

hey
insert into tblname;
is that a valid statement? it only has one autoincrement col

tias

Try it and see, its quicker to type it on your system and try it than wait for one of us to tell you its ok

i cant right now

thx

nope, doesn't work
insert into tblname values();

thank you, how would i insert it then?
ahh
thanks

poor man's sequences

spreadsheet

A relational database is NOT a spreadsheet.

hm
'While it is certainly true that properly configured data caches play a part in a high-performing database system, relying on high data cache hit rates as the sole or primary indicator of an efficiently performing database is bad practice.'
http://dev.mysql.com/tech-resources/articles/mysql-query-cache.html

dogma

yeah.
wise words
that's the first thing to teach your children

mysql caches the result set, which is fabulous.

'logical I/O counts and oftentimes counts a lot. You can't just throw memory at a database that's filled with inefficient SQL and expect things to be OK. The consistent rebuilding of complex results sets from data caches coupled with high latch (memory lock) activity can cause lots of CPU
activity that can cripple a system in no time.'

nils
i thought it would be "dont eat the strangers trouser-candy"

that's probably what I survey currently at this windows box

well… not if you want to get rid of them some time soon

nils you advise your children to eat trouser-candy from strange men in trenchcoats?

only if they have a van

ah
aim high

extra points when there is "free candy" written on it

is mysql caching on by default?
and how can i check this data cache hit rate

on by default, yes

there is this fancy mysqlreport tool

the cache gets flushed when there is an insert or update of the underlying tables

, but the two statements have different execution plans.
does that refer to things like using joins, etc?

different statements all use their own portion of the query cache
result set is cached
bases on full query

doesnt that mean that no IO is done?
if its returned from cache at a 99% hitrate

other than fetchingit from ram, no IO.

so what exactly makes it exectutwe that slow
..405 sec vs 0.005

johnb if there's logical io mentioned it's not a resultset
since resultset doesn't involve IO
table describes sql statements that are stored in cache and being computed

Hi, can someone help me with a piece of code that used to work in 4.1 but it doesnt work in version 5?

Paste the code

if query_alloc_block_size | 8192 and Qcache_total_blocks | 5 should I do 8192×5 ?
or it doesn't make sense, if there's more than 1 query ?
uh , i can also use 'Qcache_free_memory'

$msql = "(SELECT X.*
FROM c_mod X, cont_group_perm P1
LEFT JOIN cont_group_perm P2 on X.module_id=P2.module_id AND P1.group_id=P2.group_id

0 AND P1.module_id='3' AND P1.permission='Y'

AND (P2.permission is NULL OR P2.permission='Y' )
AND P1.group_id=" . session_get("group_id") . ")
UNION
(SELECT X.*
FROM ct_mod X, cont_group_perm P

0 AND P.module_id=X.module_id AND P.permission='Y' AND P.group_id=" . session_get("group_id") . ")

ORDER BY sequence";

woah

yeah sorry

too late

i've spent 5 hours trying to figure it out and im giving up
it's returning an empty set in v 5.0
but it does work in 4.1.20

how can i see what users have privs on my DB
?
i have CL access

seekwill?

sqlnoob?

can you make out anything from the code?

anyone
need help
anyone ? :P

Don't use table lists (comma separated) in the FROM clause. Use JOIN instead. Then add ()'s to make sure the join order is as you intend.
The behavior changed from 4.1 to 5.x.

ahhhhhhhhhhhhhhhhhhhhhh changed how?
i couldnt find anything like that in all those websites i've visited.. i might be googling incorrectly

Doesn't matter. Just do as I suggested and force the JOIN logic you require.

C)

ok so it's a behavior problem, I'll have to read how it change cause I'm not sure how to modify that.. thanks for the hand at least now i know where to look for more specifically

That must mean you don't understand your current query.

I don't know what's the intention with the code, I didnt write it i'm only trying to make it work with 5.0
and also P1.group_id=P2.group_id doesnt make sense to me.. since P1 and P2 are the same table, no? (cont_group_perm)

How can you *make it work*? You need to know what it does.

i dont know how, that's all I got, I dont even have the session_get function

Is their a mysql channel specific for Windows?

FROM (A, B) LEFT JOIN C .. is not equivalent to FROM A, (B LEFT JOIN C) … That's the difference between 4.1 and 5.x
We handle all MySQL questions. Just try to avoid asking how to use your OS, although sometimes we answer those questions as well.

Well, my issue is that no matter what I do, all my installs on Windows seem to fail. Basicly it claims that the InnoDB engine is not available, and the DB goes down.
I've googled and many suggest un-install and re-install, done that severeal times, and no difference.

What version of MySQL did you try to install?

5.0.45 and 5.1
The install is occuring on a Windows 2003 Small Business Server ( So SQL Server is on there )

i see.. ok let me read more into those changes, thanks a lot

More specifically, what file did you download and install?

mysql-5.0.45-win32.zip

JOIN seemed affected only by natural joins and joins with USING, that code isnt using any of those, is it?

43,413 bytes.

I don't know what you mean by "JOIN seemed affected".

since resultset doesn't involve IO
table describes sql statements that are stored in cache and being computed

you still around

That should be fine. Maybe you have a config file problem.

that's the behavioral change introduced from 4.1 to 5.0, no? OK i think im just too tired

No.

If I go and hack the config file, and remove the default table setup as InnoDB back to MyISAM I am able to start the database without crash, but I can't connect to it.

C

That's no longer the case.

oh i got it.. well from ur example I just cant understand why doesnt ppl write more about it cause it's a big deal

It's a very big deal.

C) huh

But to be honest, the SQL you showed should never have been written to behave by shear luck.

oh man.. i cant believe i spent all my afternoon looking for that and u solved it right away

*nod*
The new behavior follows the SQL standard more closely.

I see… u know what? i owe u this life and the next one.. thanks so much i know the code was bulky and hardly interesting

If you want to make the smallest change, just adjust your SQL like this: FROM (A,B) LEFT JOIN C ON …

so it was a matter of just adding brakets………

… to force the join order, yes. That's it.

seriously i'd still be looking for days if u wouldnt had been here, god.. i can finally go to sleep

You're welcome.

hey
i have a problem, i dont have a my.cnf config
i used to have it but now it's not there

SELECT *, EXPRESSION() AS `Location`.`distance` FROM `things` AS `Thing`, `locations` AS `Location` WHERE `Location`.`id` = `Thing`.`location_id` HAVING `Location`.`distance` = '20'; ?
EXPRESSION() of course being a valid expression

it's a production criticel server and i do not dare restart mysql, can i?

You better recover the old my.cnf file quick.

Xgc, yea but thats a problem
Xgc, it was a standard freebsd mysql config

You might be able to determine many of the settings by: show variables; before shutting down this server.
Show the exact SQL and the exact error. Use the pastebin.

Xgc, is there any where i can download a standard freebsd config?

I'm sure any standar freebsd package is available from freebsd.

So I'm guessing my windows install problem, is not common

I've never seen it personally.

This is just a fresh install, and I'm perplexed.
Any sugestions on someone else on the channel that might be a Guru?

Of course, I'm using 5.0.37-community-log
How are you starting the server, via service?

Yep, windows service.

Post the startup parameters you're using.
Show "path to executable".

"CProgram Files\MySQL\MySQL Server 5.1\bin\mysqld-nt" –defaults-file="CProgram Files\MySQL\MySQL Server 5.1\my.ini" MySQL
This is the 5.1 version I installed, I can un-install and install 5.x but I'm having the exact same problem with 5.1 as I was with 5.0
The my.ini file Is what is created by the installer, and with all the default answers.

I don't have any spaces in my path. That's probably not an issue, but that is one difference.
*nod* That should be fine.
Did you check the ini file?

I've looked at it and it looks nornal, I can past bin it if you like,

I also use mysqld, not mysqld-nt.
You might try that change.

Hmm, how do I change it?

Just try starting the server manually, using mysqld and not mysqld-nt.
The executables seem to be identical. That might not make a difference, unless the server changes behavior based on it's name.

Trying now.
For some reason it won't start via the command line…
I'm almost suspecting some sort of viri on this box that's making it act wonky…
Have you seen Spyware/Viri that messes with MySql??

how do I get size of all rows in table ?
in Mb
or it is easier to see table file ?

hi
is anybody understand russian? because I don't… and I have a mysql problem and probably found in opennet.ru forum topic? eee?

whats the commandwhere i can see all my users
and what users have want rights ?

might have better luck describing the actual problem?

I try to install 5.0.45 from source to debian
and I get segfault
I have debian etch + rsbac AMD64 on Opteron 170 (dualcore) + 4g ram
factorial[24612]: segfault at 0000000000020ec1 rip 00000000004038ac rsp 00007fff212e1ad0
error 4

hi i have lost my password as root is there anyway i can reset it via ssh

http://blog.dotkam.com/index.php/2007/04/10/mysql-reset-lost-root-password/

thanks will try it now

root password
reset password
!tell nath0099 about reset password

nath0099

hello, I have a question regarding the initial install/setup of mysql on linux(im using pclinux*)
when i 1st used mysql on wndows there was this precaution the user had to take to immidiatly change the root pw
is that still the same in regards to linux?

UPDATE `table` SET blah='a' AND fdkjd='fdad' WHERE…. etc
?

http://rafb.net/p/fVldMU84.html how can i select unique galleries that are in 'A'

!m Trent update syn

Trent see http://dev.mysql.com/doc/refman/5.0/en/update.html

i want to select unique id_gal where flag = 'A'
but not 'A' AND 'C' you see ?
seekwill, do you see what i mean ?

| 388854 | 14 | A |
| 388854 | 28 | C |
| 388854 | 3 | A |
| 388854 | 355 | A |
Which one do you want?

did anyone here caught my question?

Or because 38854 has a C, you don't want it?

seekwill, Thanks for the link, just don't quite understand the [ ,
UPDATE [LOW_PRIORITY] [IGNORE] table_references
SET col_name1=expr1 [, col_name2=expr2 …]
[WHERE where_condition]

Instead of your AND, use ,

seekwill, Thank you.

[ ] means optional

seekwill,

heliostech:

on the whole table my query has to return 392492
for example

That's the only one it should return?

yeah because that the only one not having an flag 'C'

ok tried that link

but an id_gal can have 'A' and 'C' like the 388854

Access denied for user 'root'@'localhost' (using password: YES)

Wrong password

I am getting an error message indicating that column 'OrderID' in field list is ambiguous.

Means that column is in two tables and it doesn't know which one you want

yep that cos i dont know it

!tell nath0099 about reset root

nath0099 See http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html

I don't know how to do that, but I really want to figure it out…

check out group_concat http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat
you too

He doesn't want that though

http://pastebin.com/d3a57cc44
Seekwill

seekwill, i know it's weird

certainty is not zen
why not?

i haven't design the database and maybe i would have used another kind of stuff
thoughtful, i'm looking

how do i grant a host access?

group_concat the values in the field, then look for a pattern that isn't ('A','C')

I am trying to rpint a report that shows the company name, orderID, and total price for all items over $10,000

problem solved

lol
OrderIS is in two or more tables. You need to specify which table you want to use.

HOw do I do that?

Northwind… lol… Using Access?

thoughtful, i think it's slow

Customers.OrderID or Orders.OrderID or Order_Details.OrderID
Pick the one you want the data from

it may well be. but aside from doing some kind of hardwired join thing, or handling it in code, that's about all you have.

thoughtful, you wanna do a WHERE LOCATE ?

ok. I wanted some other attributes in the same table as Order ID.

Is it just "Not C" or is it "Only A"?

NOT C

How about this

i could JOIN non 'C' id_gal
SELF JOIN

Yeah. I was thinking that

let me try

Good. PM me the results. /me goes to sleep

bam goes your logic when you add another flag you want to ignore.

Another join

right, ad infinitum

thoughtful, yeah it's an ISSUE
i have N flags A is the lowset

g'night seekwill, dream of zen things.

A cat doesn't display B or C or other items
….

how can i grant every body access to mysql??

publish your root password

send me your root password i will do it omha

haha

thoughtful, lol

how funny

same reflex

snap

just type init 0

how can i grant all hosts access to mysql?
so i dont get [1130] dbconn: mysql_connect: Host 'phobo not allowed

!m omha adding new user

omha see http://dev.mysql.com/doc/refman/5.0/en/adding-users.html

does anyone know nice poker site for linux
i don't wanna install wine

unibet run in java

ok

and nordicBet poker
those should work

Can't reopen table: 'tmp'
seekwill, unfortunalty my table is a freaking ! temporary table

UPDATE `data` SET stamp='1186119585', SET users='0' WHERE field='1' What's wrong with this query?

i don't know why we can't re-open tmp table but that's VERY anoying
don't put SET twice

heliostech, Thanks.

UPDATE `data` SET stamp=1186119585, users=0 WHERE field=1

heliostech, I'm just blind
=]

don't quote integer's

Hi people! I need some small help.
Can somebody tell me how to query a table to determine the highest number of a column?

!m MrSmile MAX

MrSmile see http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html

nope, wrong one?

I need to select records from a table that match in two different rows
so that is an AND statement right?

that doesn't make sense on the surface.
no, that would be two different columns, not two different rows

hmm - what I am trying to do is find all of the records in a table that have both A in row 1 and B in row 2
ok thank you that is true two different columns

so, you do mean different columns of the same row (ie the same record?)?

hello, what is elegant way to manage changes in database let say the codes ; stored procedures, function queries?
anybody use versioning to mark changes in stored procedures?

MySQL Query Browser?
not exactly elegant, but free.

yes that is what I mean

so do primary keys need to be indexed?

how do we know the latest one?
i mean the latest stored procedures, the latest functions?

I found people use table name with minus (like 'abc-a') — is this commonly accepted by mysql now ?

yes, the AND operator is probably what you want.

as long as you put them in backticks (`abc-a`) it's fine

yes, a key is a type of index.

yes I notice that . — what's your vote ? is this a good practice ?

it is good practice to always quote properly

they're the ones on the server? if you want something more 'enterprise' than that, you're probably going to have to pay for it.

yes - to be a software developer — we have to change some code now

i think that is not my question
if we have several database developers, how do we manage the changes in databases?

thanks bye

consider the database is in production, how to we push the changes in stored procedures for example
do we use versioning in stored procedures?

again, you might find something like SQLYog can help you manage that (or it may not). There is almost certainly a commercial product out there that builds versioning in. Aside from that, maintain your definitions in files, apply versioning to them, and execute your changes against the server
manually.

with a little bit of playing around, you could create scripts that would execute updates from files stored in a directory structure. not that hard at all.

how to compares codes? any tools to do that?

do a google search on "diff" for your platform (if on Windows, check out WinMerge)

seekwill, i found a fast way

meld diff viewer is a good diff for linux

i'm using MAX(`flag`) and filtering with an HAVING clause

pray no-one adds another flag value that breaks that ;-)

good morning

thoughtful, it won't break it at all

how much overhead does replication introduce?

on master ?
or slave ?

on master

replication is much faster than insert

okay. shrug.

master have to maintain just a binlog
so an extra writing on the hard drive,
but fast ones, it can handle easly 10 000 log / sec
INSERT / UPDATE
2 replication thread on the slave will be running, one connect on master and fetch the master log
and maintain a local log
second execute replication query from local slave log
it's pretty light
much lighter than clustering
it's async, clustering is synced replication
got it ?

yes
excellet answers
and why i ask? cause we have one extra busy server which also acts as a master. boss were thinking that maybe we should shutdown the replication to get more I/O out of the poor server
so, turning replication off is not a fair trade between performance and data integrity. just as i thought, just wanted a second opinion

anyone know offhand the version where mysql varchar was able to hold 65k ?

H! Can somebody tell me quickly how to drop a primary key?

am i the only one that finds it ironic that the mysql website has a horrible built in search?

husku, are you sure you are running a disk speed issue ./
?
that's weird
it's really rare
disk writing issue
if you have slow insert you must use less INDEX and MyISAM table,
with bulk insert

well, in my opinion it is an disk read issue, and has nothing to do with replication….

install mytop

http://dev.mysql.com/doc/refman/5.0/en/string-type-overview.html

you will see what's going on the server
husku, what application is this ?

mainly our probs are from selects and… well, i tuned indexes and queries already

or what you can do is if you have enought ram space,

i have mytop, also innotop

replicate into a tmpfs partition
but it'
but it's very dangerous if you have a kernel panic or a power failure

it is an 12gb db in a machine that has 2gb ram and lots of other work to do besides bei'ing db master
well, thats an interesting idea, keeping the binlog in tmpfs

after version 5.03 , thanks simplexio

yes, and it would not help us because our problems (afaik) are not insert/update related.
i mean, we have "tons" of inserts/updates but much more reads, and the queries that take time are selects
thank you

why do you replicated then ?

use only SELECT on B

it will be MUCH faster cause you won't have LOCK table slow down issues

well, machine B does its selects from B:s db

best architecture is 3 servers, 1 MASTER for inserts, 2 slave for only SELECT queries
if you make SELECT on the MASTER you will slow down the MASTER
INSERT's

yes

in order to properly escape a string, you have to replace ' with \' right?
if ' exists in teh string of course
and \ with \\ ?

That's correct. If you're escaping in PHP, you should just use the mysql_escape_string() function

hi, how do i truncate whole database?

terver, drop database ?

i want to leave all those table definitions
ah, drop database work with replication either, ok then, thanks.

foreach()

http://mysql-sr-lib.sourceforge.net/doc/reference_guide.html#for_each_loops

$query="INSERT INTO users (caller_id) VALUE ('$caller_id') WHERE username='$username'";
what is wrong with that statement?

its php
and the server will tell you what it does not understand
and did you mean update

good morning

morning campers

!man alter table

see http://dev.mysql.com/doc/refman/5.0/en/alter-table.html

anyone awake

íó

got a left / right join issue
table as two id's that point to two diffrent refrecne tables only one is set
i need to think about this..

hello
i want to deltete all the items of my table
i m not sure cause i don t want to delete the table
just the item
what is the commad
i m not sur ebut it s not delete * mytable?

truncate
!man truncate

see http://dev.mysql.com/doc/refman/5.0/en/truncate.html

no
it s delete from mytable

hello. is it suggested to create an index on a simple join table (which only holds 2 integer columns not null)?

morning

hi
anyone knows how to get rid of the "extended-insert" option with mysqldump? it is by default and i can't find the option to remove it

mysqldump –help

hey archivistttt

who mmmmee

–extended-insert=FALSE : this not in the man page… thanks

mysqldump –help .. look at the bottom
it's there

yep that's what i saw
i said it's in the help but not in the man
of my distro at least

what kind of schema would you propose when you just need to store the contact information of a website.. i.e a text field or something…
basically because it is multi-lingual
but it's not really a row-based subject…

but they are
msg,lang,short prompt, long,help
and they can also be field header prompts
and can make a single purpose table cover more types cleanly

sorry, phone…
field header prompts? what is this

hmm I dont have the version with it online
I need to upgrade the progs and db

hmmm
uhm
how does one do a SELECT UseRId FROM TABLE WHERE UserID NOT IN SOMEOTHERTABLE?

a not in b

SELECT a.* FROM a LEFT JOIN b ON a.id = b.id WHERE b.id IS NULL;

SELECT * FROM mail_users JOIN mail_list_users ON mail_users.UserId = mail_list_users.UserId WHERE mail_list_users.UserId = null;
like that?
that returns 0 rows all the time
I want the users that is not assigned to a list
IE WHERE mail_list_users.ListId = X

you forgot the left

this is alot different from MSSQL
SELECT * FROM mail_users LEFT JOIN mail_list_users ON mail_users.UserId = mail_list_users.UserId WHERE mail_list_users.UserId = null;
return 0 records
nevermind
I am being a idiot
uhm if I add AND mail_list_users.ListId = 57
it reutnrs 0 rows
not 2
ok I am not that crazy
lol
it returns 0
evne tho I can see 1 linked user and 1 unlined user

Hi

Hi. `sudo mysql -pSECRET` fails with `ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)". However, I think it worked fine before. And currently PHPMyAdmin works also. Any hints?

well, first of all, you can only use "sudo mysql -p" then enter the password when it asks for it :p
actually, if you're sudo-ing, just type in "sudo mysql"

same error

well….gah….
change your directory to where ever mysql is and type in "sudo ./mysql"?
from tehre, create a user!

well… same error

…sheet x.x
so…..hmm…..

mysql -u username -p

I never had that problem x.x

Back when I installed Joomla, I did create a user and grant it "all privileges" to the joomla db
awww
all along I was just using the wrong password!
thanks
I'm officially lame today _

XD
that's what the business would call and ID107 error _;

yeah

or maybe I just like to pretend I'm ze business!
ze sun, she rises!

Sorry to ask again, but how do I insert a .sql file into a recently created database?

_;
you mean an sql script?

Not quite sure.

_

A mysql.sql packaged with openvcpd.

mh…

x.x
I have no idea!

That is supposed to be inserted into a running database.

if there is mysql inside you can do it with mysql on console

how can i set the default table type that is created to utf8 ?

how can I change a unixtimestamp to a human redable date in my database (to hundreds of fields) ?
thanks

….touch them?

!man date and time f

see http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

Hm, when I do `GRANT ALL ON phorum.* TO root@localhost IDENTIFIED BY secret;` I get "…You have an error in your SQL syntax" - why's that?
(trying to install Phorum, obviously

you need to type "GRANT ALL ON phorum.* TO 'root'@'localhost' IDENTIFIED BY password;"
you forgot the literals :p

ah, thanks a lot

any time
…..you'll REALLY need to learn SQL
I mean…the whole structure of the database is in SQL
I spent 8 months learning it before I got my OCP :p

right, but the forum manages that. So, if the forum never breaks… which is a big "if"…
anyway, I guess I'll learn the basics then.

yeah…and the basics are enough, once you get to subqueries or so

aha

what do i have to so to force mysql to always create a table's char set to be utf8 ?

no idea o.o

set the server default charset?

If X field has value 5 and we make UPDATE query with X=5, will X index be updated too (X is an index)?

Can I select the matching text of a regex somehow?

!man rlike(

Sorry - I have no idea what function you're talking about! but try http://dev.mysql.com/rlike(

!man rlike

see http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html

Sorry, but using REGEX only returns 0 or 1, doesn't it?

yes

And did ask getting the matched text, not the bool value matches, does not match. So I have to use PHP for that. Thanks.

Hi guys. Anyone know what the status of mysql workbench/osx is? I can't seem to find anything on it.

its alpha on those systems its on

it still under development? the site only mentions the windows app.

its getting a major rewrrite

Comments

hi i use scriptaculous autocompleter I make it scrolling using overflowauto Onfortunally if I have a long list

objElement.offsetHeight
should work imo
imo here jquery is what you want too there exist $(document).ready(function() {}; which is executed immediatly when domtree is loaded

hey everyone

is there a channel for lightwindow ?
or should i go to scriptaculous ?

jquery will kill javascript
:P

=/
way to nick alert me

sorry

for this i would try the event DOMContentLoaded. It doesn't work
so it wouldn't work with jquery either

Byan lol

is there a way to get normal error messages from IE6 ?

what is a good way to check if a key exists within an array?

if(array[key]){ /* it exists */ } could work, not sure
^

define 'normal' ?

if(key in array) works

mrkaps - normal : not only line number and character , but with file name too
for start

there's a firebug lite script that you can include for IE which will give you some extended info
but IE is setup to be used with a realtime attatched debugger
ie. Microsoft's Script Debugger app

that doesn't work

(pretty sure its still a free download)

as

what doesnt work?

huh? idk i started typing as my friend on the phone decided to confuse me -.-

lol ok
you can also download the web development portion of visual studio express, and use that to debug with IE, which will let you step through the script in realtime, add var watches, good stuff
http://msdn.microsoft.com/vstudio/express/
(free)

andrew_, stepping throught would be nice .. but , i get error at line 1500-something , and with no filename

hi all. can i affect newly opened tab in firefox ? if i have opened that tab and i have link to it

how can you open a page in a new tab? .

i bet it would be a long way to step through whole scriptaculous/prototype/lightwindow

nice =P

ehh

window.open do this. if firefox configured to open new window in tabs

oh
var blahblshfaslfsadfas=window.open(………); ?

aha

the firebug lite script might give you filename without stepping through
ie's script error reporting was designed around a stepthrough debugger, so if youre used to firefox's error reporting, then you'll prolly consider it limited. sadly theres nothing that im aware of to extend that

moin

mo

does the canvas tag support text?

canvas tag?

Yea

is there a foreac() in javascript? I need to loop through an associative array

yeah foreach (var key in myarr) { }

for (foo in bar) {} should work to
i dont think foreach is that well supported

there's no assoc. array in javaScript

just use objects

Ripley's believe it or not

var foo = {key : 'value', key : 'value',}

hi. i use scriptaculous autocompleter. I make it scrolling using overflow:auto. Onfortunally if I have a long list that I dismiss and make another long list without reloading, the div remains on the position inside the overflow area. So how can I reset that overflow area?

what is something like var myArr = new Array(); var myArr["something"] = "some data";

hi all

it's wrong

why?

because arrays have indexes, not keys
that's why they're arrays

ok what you call what I posted?

it's a way of abusing an array because it's also an object

abusing an array?

you should just use "var myHash = {}; myHash['something'] = 'some data';"

where is that documented, google doesn't return much

it's just an object

I wouldn't call it a hash tho

http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Literals#Object_Literals
true, that's kind of misleading too

indeeds
associative-array best fits the description

well, i think hash maps is a better term for js objects in general
well, i think hash maps is a better term for js objects in general

bbiab
"hash maps" denotes implementatoin. ASsociative ARray does not.
…. why did I type that using PAscal CAsing? o.O

but the implementation is pretty transparent..
anyway, it doesn't really matter much what we call it, as long as we know how it works

hello!!
anyone here uses scriptaculos?
I have created a Sortable element and I get the sequence

hello

and then I later compare the sequence to the one I saved
I have used an alert and they are equal

so say I have some db info and I need to return multiple rows in an array. var myArr = new Array(); myArr[0] = new Object(); myArr.field1 = "hello"; myArr.field2 = "some more data";

but when I do a == it gives me false
anyone know why?

is thisi right? form name=formname action=blaha name=name href=# onclick="document.forms.formname.submit()"/form

nevermind
I am comparing objects

Acs, why aren't you using " around all your fields?
your could use this.form.submit() instead…

this.form.submits returns: this.form has no properties

Hello, I am learning the Ajax stuff. Can you test my work? http://jouts.net/GuessJouts.html

bha
no
too lazy to move my mouse ver your link :p
over

hi all

try to think it might be pr0n, you won't be lazy anymore
:P

Yns, yo man

is there any good method for debugging in javascript except firebug/firefox error console?

myArr[0].field1 = 'hello';

Yns the good ol' alert() debugging

Yns, try{ /* your code*/}catch(e){alert('an error happened! ' + e)}

VistaBear, thanks man.

why does it say this.form has no properties? the form has been defined

Thanks for the "boobs", no more players? http://jouts.net

dunno, PY1NB

is that in the form action? use just "this"

this.submit is not a function

show the line

Is this valid JS? "} catch( e if e == "RanklogEntryParseError" ){ " ?`

torarne2, no

hi csaba
SimpleSample here. Remember me?

brainy^: why would someone write that? is it part of another standard or language?

hi again

torarne2, i think only mozilla supports this

where were you? show the line this.submit

ok, thanks

torarne2, part of JS 1.5
http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Referencetatements:try…catch#Conditional_catch_clauses

now can I loop through my new hash somehow, or whatever you want to call it

someone kicked my power cord
a name=receber href=\"#\" onclick=\"this.form.submit()\"checar contas a receber/a
the \" are for php print it finely

PY1N1, only inputs have a form property

conditional catch seems kinda useless

like that

and use style to make it appear as a link

oh boy

oi PY1N1

oi wnix, brasileiro? maraca?

sim, de bh
esse seu comando funcionaria só se fosse num botão de submit
me diga, sua página tem um formulário só ou mais de um?

vamos falar em portugues no pvt, pse

ok, pvt-me

yo wnix what's up?

;D
how are you?

i was watching family guy, only noticed you wrote cause the taskbar flashed

hmm, esse nick nao ta registrado. vc pode dar join no #py1nb ?

hum, great

tnx

hey, that jsdraw is amazing

`js ref

`js domref

huh? jsdraw? the dLL?

Hey all, I'm trying to change the cursor on a td to a pointer and then back to default with js.
document.getElementById('UseBackgroundColor').style.cursor = default this doesn't work.

use quotes
……cursor = "default";

Ah thanks!

this http://www.danga.com/misc/jsdraw/xmlhttp.html
use firefox

Ok guys, we need to plot an evil plan to teminate IE!

lol
I like IE
but like FF more ;]

]]]+
wrong channel

contaminate

or a href="javascript:blah();"?

(or is this offtopic)

I drew something for you

neither

element

beatiful eyes

pretty much any element can have an onclick
even better would be not to put those attributes into the HTML, but to use a javascript function to add your javascript handlers
that's pretty advanced though, so don't worry about that if you aren't that experienced

http://projectx.daedeloth.be/
I don't have a debugger, but could someone tell me what file and what line I should look at? :-)

nope, I'll go for it. thanks a lot

remember you can use the cursor:pointer CSS attribute to change the mouse cursor when it's over an element

yep of coure

for their onclicks because they don't know about that

course*
right

anyone here running windows?

daedeloth
req.xmlHttpCounter = xmlHttpRequestCounter;
line 52

k, thanks

in ajax.js

hm what should that be? var req.xmlHttpCounter ?

xmlHttpCounter isn't a property from req object

hm so I can't add new properties? I thought I could thread it like a general object?

in firefox, safari, opera yes
in ie7 I don't know
ie 6 or less no

hm, k. I don't really need it anyway, I'll remove it.
damn, those pngs look sucky in IE

req.prototype.xmlHttpCounter = xmlHttpRequestCounter;

hum

wouldn't that work?

try that vistabear says

ah, k. I'll give it a try

in IE 6 and less, use an activex
so, I don't know if it works fine

yep
oh well I'll just remove it, never mind.

are there anyone still running IE 5.X ? 0o

okay it's kindof working. any clues how I could fix those pngs?

daedeloth, you want them to be transparent?

yep

use alpha filter in css
(IE only shit)

compare IE's version to firefoxs version -

hi

daedeloth, http://www.nczonline.net/archive/2007/1/406
piXelshooter, hi there!
sup?

I'd linke to create a popup-window that does something with the last activated other browser window, exactly, with the url. So, I'd like to check the url of the last activated other window.
is that possible?

http://projectx.daedeloth.be/images.php

sorry, no, piXelshooter

oh… not good.

great system
congrats

there's the difficult option of POSTing the current URL to the popup, then PHPing it into the js

piXelshooter, like I wrote yesterday, this applies to urls also:

you cannot alter other pages other than the current one with javascript, and you cannot hide the adressbar unless you do it when opening the windows with window.open

hmm, I *think* I've seen scripts that manipulate other windows but I might be wrong

if you use window.open, you might have success
like var aWindow = window.open('url', …); aWindow.location.href = 'new location'

well, I think, that isn't actually what I think of:
I have a list of browser windows/tabs.
then I open my script page (ie, via bookmarklet)
the script shall do something with the url of the window I had open before.
til here, no problem
but now, I would it like more this way:
my window is open, and I change the url of the old window, ie per link.
now, my window should recognize that the url of the last used other window changed.

hello! why I get for document.createElement('embde') a typeof 'function
?
only in firefox

if I realize it, I wouldn't have to recall the code again and again.

add an onunload hanfdler, which reports back to the parent window?

did you mean 'embed'?

document.createElement('embed')

hm, or add an onclick handler on the links

yes

vistaBear, ok, i'll try it ;D
eer, and, is there something like onminimize (I know, it diesn't exist), that is called when the window is minimized?

if there is something, google will tell you, but i think there isn't (and i hope there isn't)

ok, but, why do you hope so?

piXelshooter - because I don't want your script to know when i minimize
that's a useragent behavior that should have nothing to do with what is going on inside the window

i don'T want any action to happen when i minimize, such as… prevent it, open a popup, play a sound, alert something, etc.
that actually enters in the "Don't mess with our browser" rule

hi

is this valid var groups = new Array();
var groups[0] = new Object();
to create an object within an array

I have a onclick event matched to a form's buttom and in the javascript function is like that http://pastebin.ca/655637

The paste 655637 has been copied to http://erxz.com/pb/4017

but the form is still sending even when fields are empty
I have got something like input type="submit" value="Save" onClick="edit();"//div
do I have to add a return?

hmmhesays, yes

and not in onclick in the input

because that does not sem to work

var groups = new Array(); groups[0] = new Object();
eval var groups = new Array(); groups[0] = new Object();

''ERROR: syntax error at (eval 212) line 2, at EOF

if I load a page into an iframe, how can I use the javascript called in that page to be used instead of the parent window's javascript?

You want to disable Javascript in the parent?

know, i just want to use to prototype.js in my iframe's env instead of the parent's
know = no

I think both will run.
I think it depends on the user agent though.

well, they seem to partly, although, I don't seem to have access to the Array methods that prototype.js offers in the iframe. I only seem to get those methods in the parent
even if I call prototype.js in the iframe

fozze, js in firefox has that natively
array.forEach

yah, but I have to get this to work in IE too

Then get it to work in IE too…
Should be a simple conditional.

hello. I am having some pretty simple issue with a script I've been working on… was hoping to find some help
this is the correct place to go to?

hey folks … how to retrieve part of some page and then to display info with js on other ?

ajax

functionName is not defined. even though it is indeed defined in the js

mefisto, any examples maybe ?

don't know if this will help you, but take a look: http://www.xul.fr
they have some pretty simple ajax examples
and what you described sounds like something simple enough that you can just copy their codes and make changes

hey..
does anyone know how I can scroll to an element?

not sure, but it might involve making an anchor

tnx atula

if I have post = document.getElementById('post1234'), how do I make that the "top" of the page?
…or the top of the viewing area

hey everyone

perhaps you can make that a div and then make it absolute positioning?

hmm. what if I alter window.location.hash?

and in stylesheet, make the necessary positioning place?

I dont have access to the stylesheet
it's a greasemonkey script

hmmmm then how can you get the id?

hello, how is the md5 function called that is buildin to javascript ?

you can set css in gm scripts too

you can do inline style too… div style="position:absolute; yadda"/div

rocketmagnet, http://www.myersdaily.org/joseph/javascript/md5.js

yeah, but i can't use position for this

wasn't there a function from javascript hosting ?

in js function 'md5' doesn't exists

can i specify utf8 encoding for js file?
i kinda have it in php hosting and have header application/x-javascript

?

so i can just add this .js file and use md5('somevalue') ?

yea)

dabear, window.scrollTo(0, post.offsetTop));

kronos, if web page is in utf8, its gonna kinda expect js in utf8 as well right?

grimboy, nice
I'll try that

i want restrict user input same maskedit in windows application any one can help me.

rimad, i think yes, but you can test it)

hi

hey enzo

imagine i have input id="foo", i have var foo_object = getElementById("foo"), with var foo_object, how can i get it's id name back ? (foo)

this placing dynamically created tables really sucks
they aren't going where I think they should

enum, foo_object.id
enzo, foo_object.id

should I be using span instead of div if I don't want paragraph breaks?

ok grimboy

is inline.

anyone here use Ajaxpro
the .NET library

inline

i'd like to know if i can tack properties onto the result object
the server side return value

what is an appropriate way to stop or at least handle dhtml applications when the refresh / back / forward buttons are used?

any example how to retrieve text content from td element and to make that text to be clickable ?

' + td.innerHTML +'/a'

dabear, it's for gm script … and i have like 20 td's on that page … but there's only one with "health" text in it

??

i have page that have 20 td on it … and i need only one … how to retrieve it's text ?

document.getElementById('table').cells[0].innerHTML

oh … nice … tnx

Hi, Can someone help me please? http://rafb.net/p/ESoXgF14.html This is working on FF, But not in IE, Does someone know what is wrong? (It must count how many emails are 'sent') (Sorry for my bad english btw)

what a horrible code O.o
Why you have in method in class echo function
blech

hmm..

create method is … heh
First. Don't use echo funciton in methods, you should return string and then write it in code.

i have var tab = [], i want to add an element in tab[2], how can i do that ? tab[2] is another array
maybe tab[2][] = 'foo' ?

enzo, that doesn't work in js
if tab[2] is an array, you can use tab[2].push('foo')

ok

anyone have any experience generating dynamic tables? I'm having some trouble appending them to my DIV tags and making them go where I want them to
layout wise

hmmhesays, avoid innerHTML…

avoid it where?
I'm only using inner html on cells, when the tables are generated they look just like I want to them

element too, otherwise the table wont get displayed in ie6

avoid using innerHTML when writing tables

like I said the tables look just like I want them to
however, for the life of me I cannot get them to sit side by side
when I generate the second table based on what the first table was clicked, it is always underneath

how do i detect for onsubmit in my header javascript?

is there a way to safely include external javascript file via javascript code?
!seen buubot
seen buubot

Sorry, I haven't seen buubot

seen Byan

way to nick alert me

thats what I can't figure out
I tried appending my tables to a div tag and span, same result

_

beer Byan

what is your opinion on SVG vs js+ dom ?

there is no vs for svg, dom and js
at least i cant see one

http://www.kevlindev.com/tutorials/basics/index.htm

"AhmedShaikhM" at 71.6.194.243 pasted "javascript code" (1 line) at http://erxz.com/pb/4018

so do you have any idea how I generate two seperate tables and make them sit side by side?

depends where the data is coming from that you want to display
and if it needs to be fast
generating svg with js+dom is quite easy but horrible slow
so, what do you want to do?

yep, probably svg is more sutable for real-time graphing
suitable
gfldex just exploring technology

i create stuff with inkscape and add some js for dynamic stuff to it

trying to identify svg's place

hard to tell atm
it's not really well supported and if you leave the warm and fuzzy mozilla realm you will be surprised quite often with svg
you can do quite a lot fancy stuff
like interaction between svg and the surrounding page

i think comparison should be done in js+svg vs flash
http://www.carto.net/papers/svg/comparison_flash_svg/

that exactly what you cant do anymore with flash
you can't access javascript objects of the html part from a flash on a page

Meh, svg. Canvas

even if they come from the same domain
but svg is a lot slower as flash

is there a way to safely include external javascript file via javascript code?
"javascript code" (1 line) at http://erxz.com/pb/4018

AhmedShaikhM eval ?

if you are used to xml and use xslt, css and such quite heavy and can convince your users to use mozilla or opera it's quite nice
and can save you a lot work

AhmedShaikhM, document.write("script")
AhmedShaikhM, Is the only portable way.

it hangs IE7

I suppose I could user css to place my div tags

is part of HTML

Oh?

http://erxz.com/pb/4018

Yeah, I saw. I just not sure what you're doing wrong.
you might be better off having a javascript build files cause otherwise you'll end up with a lot of superfluous requests.

i want to make a child window cause a submit on the parent window… how would i do this?

javascript build files?

You know. A small script to concatenate your scripts, minify them, pre-gzip them and give them a timestamp so you can get your webserver to sent some ridiculously long expires header.

"AhmedShaikhM" at 71.6.194.243 pasted "hey grimboy have a look at the code" (31 lines) at http://erxz.com/pb/4019

have a look at the new past
What I am trying to achieve is that, I want to add XHTML parts on link click so that TinyMCE editor get activate on some javascript based event

i can change the value of a form on a parent from the child window, but how can i make the parent submit too?
window.opener.document.main.displayPref.value="newSkool"; ….what other code can i put after that to make the parent submit

"SamuraiDio" at 71.6.194.243 pasted "How do i make this (the loop and the endsWith() ) without prototype?" (25 lines) at http://erxz.com/pb/4021

is window.opener.document.main.submit(); valid?

if main in the opener is a form, yes

i got the child to 1) change parent values of some fields in the parent form 2) force the parent to submit .. problem is the submit didn't "include" the modified values
which is strange, becaues you can visually see the change, for instance, in a drop down, you can see hte parent's value of hte drop down change, but the child making the parent submit, doesnt seem to keep this change

rook2pawn, What if you put a timeout on the submit?

what for, im not closing the popup. the child is used to make display adjustments on the parent

can anyone destermine the purpose of hte ? and the :…is that a ternary operator used in a regular expression? /(\d+)(?\.\d+)|)/

non-capturing-group construct.

the first (\d+) captures a series of digits, the second one doesn't capture but places into a group.

it's kindof superflous in that example

the reason why you would want a noncaptured group is so you can express more complicated matching patterns, such 5555.88888 or 5555.foo but not 5555

you could as easily write /(\d+)(\.\d+)|/

how do i convert a JSON string such as {"name":"test","image":"test.jpg"} to an object with the corresponding properties and values?

You use eval.

thanks

eval('var obj='+json_string); alert(obj)

Hi all!
Is there anyway I can tweak the CSS (visibility in my case) before the page is rendered using JS? When using onload() I get a moment of flickering when the black text is displayed.

thanks fatbrain, it worked… but doesn't eval() have problems in internet explorer?

rindolf, You can attach an onload to the element itself which might fire slightly quicker.

but I have many elements.

can you edit the css directly and control the classes assigned to the elements?

i have a popup change some values in the parent form, and i can visually see that the values are changed, but when i have the child make the opener parent submit, the changes are lost

yes, I can.
but I'd rather the page not be all with visibility : hidden if JS is disabled.

Why not do that then?
Oh

is there any other ways to load an XML document other than xmlDoc.load ?

rindolf, You could shove stuff inside noscripts

no.

you could look at YUI's onContentReady event and see how Yahoo is handling it.. it should be in the event library at http://developer.yahoo.com/yui/event
they have a few different events you could look at.. onContentReady, onDOMReady

how will this help me?

onDOM waits for all child nodes, onContent waits for the node to exist at all

rindolf, Stuff inside noscripts only display on browsers with no javascript/javascript turned off.

oh.

rindolf, hello

Hi pkrumins
what brings you to ##javascript ?
Well, nevermind, I'll use CSS.

interesting

rindolf, this:
http://www.catonmat.net/blog/learning-javascript-programming-language-through-video-lectures/
a href="http://www.catonmat.net/blog/learning-javascript-programming-language-through-video-lectures/"http://www.catonmat.net/blog/learning-javascript-programming-language-through-video-lectures//a

i need opbject oriented stuff anyway

I see.

my popup can change my parent's form values, but when i submit on the popup, the parent submits, but not with the data

fatbrain, ok i understand the noncapturing now, but what is this now. (?=pattern)

hi

section31, A zero-width positive look-ahead assertion.
for example "foo(?=bar)" would only match foo if it is followed by bar without including bar in the match

gotcha
thank you

You're welcome!

it is possible to work with prototype and mootools simultaneously, both?

only if they both have a function named "$"
/troll

karma vinse funny

how come you need both? seems like they have a lot of overlapping features … and i thought mootool's advantage was its small size, which you'd be negating if you're also including Prototype

vinse, mootools provide a effects..
its a question

all - how do i pull the text in an HTMLLiElement?

i want use it
but already use prototype

is the tofixed method supported by most browsers? where can i find the compatability of certain methods between diff browsers?

:w
hi all
plz
http://pastebin.ca/655920

The paste 655920 has been copied to http://erxz.com/pb/4022

he working on Firefox but not on IE
ie have some problem with getElementsByName function?

getElementsByName is a bad function. Don't use it.

I'm searching in the innerHTML of an element for any strings that could be links. I'm going to replace those strings with actual live links, so "Oh my god becky look at www.foo.com" would turn to "Oh my god becky look at a href=\"http://www.foo.com\"http://www.foo.com/a".
The reason I'm only using Javascript is because I cannot make any modifications to this "system" or "site", and this is actually my own Grease Monkey script.

and what I use to get all elements with same name ?

Here is the corresponding code, lmk if you have any questions..
http://rafb.net/p/wD0AZx45.html

Aankhen“: what is method to it, I need to count all elements with name 'marca_nome' that have text

Iterate through all the elements in the document, test their `name` attribute.

hello. how do I get an element in xml… the equivalent of .getAttribute("attr")?

ich mach jetzt feierabend. noch einen stressfreie nacht euch süßen ;P

yummy_sammich, here's some stylish code for you:
http://norskwebforum.no/pastebin/9263

one sec…
phone
brb
impressive
–n00b
thank you a lot

is there a way to use an object as an array key? http://pastie.caboo.se/87300

GMFlash, did you try it?

of course

and it didn't work?

i tried with both array and object

then you would need to assign them as values instead
like itemsByObject.push(items[i])

i need to get a link between the object reference and the array index though
so that wouldn't work

GMFlash, no, you wouldn't

itemsByObject[el] and have it return a number

because; var itemsByObject = []; itemsByObject.push(items[i]); itemsByobject[0] would be the object
so what about using the id of el instead?

they don't have ids

well, keys cannot be of type object, can they?

i thought they could be
i swear i've seen it before

so you have to make your self a function or something
ah, now I see
when you do bla[foo] = bla, you are converting your array to a hash
and a hash doesn't have a .length property

an actual type conversion takes place? so that subsequent calls to bla.length fail?

try this:
javascript:var t= new Object(); var arr = [];arr[t]='foo';alert(arr.length)
and then
javascript:var t= new Object(); var arr = [];arr[0]='foo';alert(arr.length)

i changed the array to a hash, it is partially working now
the only problem is that the value of each item in the hash is the last value of i
i'm guessing because they're all referencing the same instance of i ?

Is passing an FS Command through VB and then to JS not compatible with IE or FF?
http://pastebin.ca/655974

The paste 655974 has been copied to http://erxz.com/pb/4023

^Link to my document

gmflash the object you saw probably had a toString method, thas wjy it coul be used as an object key

you realize VBScript isn't supported in any other browser than IE, Kai_wp2 ?

Well its working in Opera.

A page with VBScript is working in Opera?
o.0

I can ensure you the vb-part is not executed in opera

ensure? heh. you mean assure?

ahh that appears to be the case

why do you explicitly specify that the args should be passed ByVal?

looks like i'll just have to give an id to each item

they are by default passed ByVal

Well the Flash passes a command to the VBScript which runs some JS and its working fine..
It doesn't work if I remove the VBScripts.

when used as keys, objects are converted to strings

Well I didn't write the VBscript so I left it.

so basically the only way to fix my problem is to set an id?

I couldn't find a way to pass vars from flash to JS so I used this.

deltab, hmm, empty strings in this case, are empty strings valid keys?

I geuss I could've used geturl();

length only counts the numbered properties of an array
they are

anyone has experience with google map api?

right, nice info, deltab

function definition inside a loop?

nah i just want to make a quick lookup/reverse lookup of an array
if i have 10 LI's in an array… index of 0-9 i want to be able to later on do something like: reverseIndex[el.id] and get a number 0-9
i thought i could just use the object reference as a key but apparently not

the object probably convert to the same string

so i'll just set an id
right it is, just found that out in a test

what do you want it for?

i'm emulating a multi-line select widget
with an ordered list, so i need to keep track of things via an index

why not use a real one?

it doesn't offer the flexibility i need

along with document.createTextNode, can you delete a text node?

note that you can add properties to the elements

or…should i just hide it?

Node:removeChild

yay
thank you

Whats the best way to pass a var to JS?
From Flash?

with mind powa
(or serverside language)

LOL A serverside language
Theres ExternalInterface.call("Function"); but it won't pass an arg

ever heard about ajax =P

ajax? what's that? sounds new and trendy

uhh

I don't like it but . Its really kewl

no don't use it, it will eat your soul

ajax is some kinda cleaner, people!

I thought it's a football club from the netherlands

use it to clean your windows or something

I thought its a kind of plane.
I use it to get to the city.

AJAX:
http://www.cleansweepsupply.com/pictures/standard/bcpm2166.jpg

JS running on the server or the lient?

I use Ariel

so that's ajax!

csaba, now its called Air =]

I won't accept this!

i dont even know why people call it ajax since it is also synchronous and can be used to pass more than just xml such as json and text

I don't really know a lot of people that call it ajax

only part that is needed in ajax is J

I use 'ajax' to mean partial replacement of a page using data requested from a server

no
wrong
you can do it with flash too

they should just call it XHR or XMLHttpRequest since that is the function name

I usually call it xmlhttp

GMFlash, i tried

that's what it's original name was

Looking for ideas on how to build a "drop zone" for files dragged from Windows explorer. I know it would be IE specific, and that there would be security concerns, but….

it's not just XML :-)

boss looked kinda strang on me

yeah i know even XMLHttpRequest isn't the correct term

you can push it directly

'ajax' is easier to pronounce

really it is just a "HTTP Request"

… used in a particular way, yes

ajax is just a word your manager uses to impress clients

and and easier to 'understand' in Marketing Section

what does json mean?

javascript object notation

ah yeah

good thing this AJAX stuff will be a thing of the past when web 3.0 is here

not really

i was just making fun of buzzwords

it was created before whole web2.0-fuss

i know for outlook web access

for that too
the same about blogs .. ppl were writing web journals at mid-90s too

everyone make sure to thank microsoft for XMLHttpRequest()

GMFlash, its hard , because it was only side effect for ActiveX

you could do ajax with images and cookies

or iframes
i'm really glad those days are gone

you can upload files too (which actually is one of coolest features )

tell me more
how?

=]

how do you go to the next iteration in a for loop ? in Perl its next()

continue;

I need a simple script that will make a label like "Searching.." appear when a form submit button is pressed
can i just do
onClick class=appear or something
i've used a class for hiding labels before so i know how to do it
i'll try it..

Saberu, why not change the text of the submit-button?

_$('submit_box_id').value = "Searching..";
assuming you are using prototype, or just have that useful function in there
function _$(x) { return document.getElementById(x); }

ah thanks didn't think of that
is there a simple way to do that?
document.getElementById('submit').value = 'Searching..'
like that?
assuming the id of my submit button was that

yes

now from usability point of view that is crazy to change search button's title to searching, what if i hit escape before the new content is returned
i would still be on the same page with that stupid searching.. button which has no longer anything to do with searching because none is going on

then I would reset the buttons value?

setTimeout

now that's better

besides, can you really reset an ajax-call using backspace?

but, how would you know the timeout to setTimeout
what if db was clogged up and search took more than usual

set a header with no-cache value, problem solved

dabear, with backspace?

how do i get the date 7 days ago?

from JS? I wouldn't…
talk to ##php

no
i need to do it client side

client side depends on the user's computer - it could be the wrong date

not using the current date

so you're just talking about some math? :p

pretty much
how do i get the date that is 7 days before a date?

but you don't want to make a matrix of how many days are in each month? :p

i dont see functions to do it in prototype or YUI

php, by writing an algorithm which subtracts 7 days from this date, duh.

blah

Question, I'm trying to refresh google ads w/o having to refresh the page. What I tried was just replacing the div with google's JS snippet with a new snippet..but apparently the JS isn't getting evaluated. Is there a way to do this?

IE6 is throwing me "object doesn't support this property or method" at a line in my code, which is "instructions.innerHTML = errorMessage;". Does anyone have a clue why this might be?

phpwner, var d = new Date();d.setTime(d.getTime()- (86400*7*1000));alert(d)
eval var d = new Date();d.setTime(d.getTime()- (86400*7*1000));write(d);

''ERROR: syntax error at (eval 212) line 2, at EOF

bha
works in the browser atleast

emm .. goal its to make it work in browsers
not just in one

yall can suck my toe

lol newb :p
@ phpwner hehe

mefisto, works, but not with buubot :p

maybe because of write(d);

eval write('foo')

''ERROR: syntax error at (eval 212) line 2, at EOF

^^

print ('foo');

foo1

eval document.write('foo')

''ERROR: syntax error at (eval 212) line 2, at EOF

new Date ();

{ }

ah well

eval document.write('foo');

''ERROR: syntax error at (eval 212) line 2, at EOF

hm, okay, probably was the bot in #prototype which used write..

hh

How to check checkbox status for checked/unchecked?

thebox.checked will be true or false depending on if it's checked or not

thank you!

how can i get this js to clear the html form after posting a comment, people keep clicking submit and posting more then once, here is my code snippet. http://pastebin.ca/656100

The paste 656100 has been copied to http://erxz.com/pb/4024

Why not disable the submit btn when pressed
onClick="this.disable();…"

ah, i could do that, would it be much harder to clear that form?

No, but usability wise it wouldn't be so nice.
It's nice to know that the information you just entered is still being submitted, and that you actually pressed the "SUBMIT" button, and not the RESET button.
know what I mean?

i guess, all of the ajax powered comments i've come accross clear the form

I always disable the submit button, and change it's inner text to something useful, like "Submitting"

ah, how can I clear the form? I will try both and see how i like them.

form.reset(), but that'll clear the values before the form is submitted, so it would be a very bizzare solution.

ah, how can i clear the values after it's submitted?

you can't

Yeah. Why are you so set on clearing the values?

because then the location would have changed
e.g you won't be on the same page

If you're waiting on an AJAX response, then clear the form with either .reset() or by clearing the values of each of the form's elements/inputs manually.

or the page is reloaded if you provide the same page in action=""

i basically want to clear the form after it's been submitted, this will stop users from clicking submit again and posting the same message. I have some pretty stupid users that will post 3-4x just because it's fun.

No. Disabling the submit button will stop users from submitting again.
clearing the form will simply…clear the form. not much else.

why not just make an array of the fields, and then for each field set the value to nothing?

hi folks

Hello chr0me.

how can i call a javascript function from php?

how do you mean?

there is an onclick event and i want to execute that js function on array elements

by putting it in output'ed html

without clicking on them

tags

make it in window.onload = funxtion(){}

onload event is usually what you want though

ok

!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"htmlheadtitle/title/headbody/body/html
oops, sorry

pkrumins, katru reizi kad tu nelieto strict, dievs nogalina ka7nu
=P

cik saveejo

oho

vells

3 gabali
pilniigi nereaali. pirmo reizi pa vairaakiem gadiem kaadu veel te satieku no .lv
tas ir freenodee, ne #js'aa

arii linuxisti biezhi gadaas attieciigajos kanaalos

Fj neviena cita te nav

aa, es par to neintereseejos, intereseejos tikai par programmeshanu, neesmu linux kanaalos, taapeec ari neesmu laikam ne1 saticis.

veel kaadi pieci toch ir satikti

nez , katr kur ir vismaz 100 cilvji, ir vismaz viens letiFa

sk.

mhm. mani veel peec latviskaa vhosta atpaziist, taapeec biezhaak samos sastopu
s/vhosta/hosta

jap
/who *.lv :P
ko darat, arii studenti esat?

7ipa , mainu augskolu
pdjs

no rtu uz lu?

aha

lu++

nez vai shii ir iistaa vietai lai to apspriestu
es ar stundents

lu?

Question, I'm trying to refresh google ads w/o having to refresh the page. What I tried was just replacing the div with google's JS snippet with a new snippet..but apparently the JS isn't getting evaluated. Is there a way to do this?

izbanos

onclick="this.disable = true"

bet no saakuma pabridinaas, tapec var.

that does not work for the submit button

mcknin, that's forbidden dude.

explain..
by google?

yeap

hmm interesting
sucks for those of us using nearly pure ajax…

you're inflating page views

well I understand the reasoning
but realistically, it's flawed

mcknin, that sounds like it's against the tos

if I have a site that navigates through a lot of different content, I should be able to change the ads

I am sure they have ways of telling that….

the fact that you are ramping up page views sucks too for google

yeap.

like I said, I understand the reasoning
but there must be some sort of middle ground
oh well, can't do much about it

I am sure they will be able to tell, or else everyone could do hundreds of thousands of hits for lawlhacks.google.com.mcknin.com

What would be the best method to resize the image to half of its original width and height by default and when you mouse over, restore its normal width and height?

is there any way to switch table cells (when first cell is going to be second and second cell replaces first) or only way is to switch their content?

can i put the onload even outside of input?
t

chr0me, yes
Slynderdale, you can set width/2 by default and width:auto on onmouseover

there's a way, but I couldn't tell you how

Isn't width:auto css?

Slynderdale, yes
but you can set CSS properties via JS

no, you cannot

obj.style.width="auto";

(starting flameware against self)

the problem is the width will be relative to its container's width

And for the shrinking it by half part, is that done via css as well or javascript?

not the img's innate dimensions
cssplay.co.uk has a lot of gallery playage

is there any way to just clear the form after it's been submitted like youtube does?
none of the onclick="" work

Slynderdale, you can calculate needed width and set it via JS.

input type="reset" ?
oh after it's been submitted :p
reisio++

yep

getelementsbytagname && value='' ?

hello, do you know a german js irc-channel? or is this the right place too

anyone?

undoubtedly some speakers of deutsch here

how can i get all elements that start with 'amount_'?
amount_ = start of name

Hmm, how do you add an atribute to a ag with javascript so you can do something like obj.newatrri = 'blah';
Hmm, how do you add an atribute to a tag with javascript so you can do something like obj.newatrri = 'blah';

you can add properties that way

is it possible to manipulate a (PNG) image using javascript?
one for "hair style" and one for the base. I want to edit the rgb values of the PNG with the hair style

hai, what is the style attribute that cuts off anything bigger than the object's size?
nvm , it's overflow

Is it possible to set onclick=".." with JS? Something like obj.onclick="newaction()"

yes.
(shal3r)

and how?

just like you did now :p

you actually just said it.
heh.

that`s not working

obj has to point to a node though

dabear, obj is document.getElementById('myid')

document.getElementById('yourelementid').onclick = "…"
That should work, unless the element isn't found.

BradleyB, nothing changes and no errors

Hmm, whats wrong with this? http://erxz.com/pb/4025

IE or FF, shal3r?

FF

Are you getting errors? And why not use setAttriubte, rather than createAttribute?
What kind of element is it?

A

Oh, and I believe the attribute names must be in a string format

I'm trying to sort an array of objects by one of the values it has… how do I do this?

getAttribute('oldwidth')

legind, you can use bubble method

any easier method?

it`s easy

Thanks and also whats the parameters for setattribute?

Slynderdale, mostly any html attribute

You know, these are all googleable things.
just look for setAttribute
it's setAttribute('attributename', attrval)

is it possible to get table cell`s position in table? Like row 0, col 1 or cellNr 32

setAttribute site:mozilla.org
tables have a rows collection, each row has a cells collection. A cell has a cellIndex property I believe
I know rows have a rowIndex.. just guessing on cells

thanks, i will look

hi all

obj.onclick = newaction;

i have a question about iframe. how can i execute an function on parent document in iframe

why are you using all those methods instead of just accessing properties?

acualy i want to send some messages with Json in iframe to parent document for file uploading…
or how can i handle form request (form is contain input file element)

I managed to figure it out already.

how have you chosen to do it?

i found, parent.functionName();

is there a bug with IE when loading an xml file?
xmldoc.documentElement returns null and xmldoc.responseXML/responseText say undefined
i get a readyState of 4 when i check it
i just can't get anything from it
how do you check if it's loading correctly? because xmldoc.hasChildNodes returns false
so i don't think it's loading anything :-S
and changing the loaded file name to one that doesn't exist doesn't give an error or anything

how do I get elements within a div? I want to get all the input elements within a div and disable them

div.childNodes

Hi !
who can i declare a static vars that belongs to a function in JS

no-can-do, helloRobot , atleast not until js 2
you can define a variable in the global scope though, which you can access in your function

doesn't firefox append the elements of a div to the dom, if its loaded via innerhtml?

how can i define a global var in javascript?

hey everyone

[domon], Variables are global by default.
Use var in the scope you want them for local variables.

okay, great!
so if i pass a var to one function, i can use it in another?

Still, you're always best off using a var in top-level code.
Or so I am told.

well my problem is tis
i have one function that displays a page
and i need to pass the variable that i passed to display to another function
thus i need a "global" var
here i'll give an example…

Err… you don't need a global variable if you're passing things in as arguemnts.
arguments

i have 3 functions…
someone will use function a
pass a variable to it
then they use function b (to login)
then i have to update the page after they login (function c) using variables passed to function a

define the variable with var varname=""; outside of the functions

In top level code as I said earlier.

got it :P

No need for the ="" though.

sorry, i'm more fluent in PHP than JS :P
and then to update the global var based on an argument….
global varname = arg; ?
or just varname = arg?

can IE not load an XML file when the file has a doctype?

just varname .. but make sure, you dont have used the same varname in the function or the function-header

yeah, i wont do that

-used+declared

last thing is….how can i determine if a var is defined…like php you can put function blah (arg1 = "default1", arg2 = "default2")

anyone?

[domon], if (arg2 === undefined) { arg2 = default}
You need 3 equals signs for a strongly typed comparison. Otherwise if arg2 is 0 it'll get rebound to default.

thx!

hey
anyone know how to get the correct height of IE's body content?
I can get the size of the window but not the content
anyone know?

document.body.clientHeight
iirc

mefisto won't work
gives me the size of the window
not the whole body

uno moment

oki
I am just trying to correct this bug in thickbox.js

it should be working
second is

it used 100% to create a div or something, but it only gets to the size of the window

document.body.scrollHeight

so if I scroll down it won't work
oohh, let's try that
gives the same thing
so it won't work

broser ?
*w

IE 6

oh

what?
are you using 7?

im using opera
lol

well I normally use FF
but I have to do this page and it has to working on both
screw opera :P

document.body.clientHeight is woring in IE6
mkey , im gonr
*gone

mefisto I know it works
the problem is it's not giving the correct size

how do i trigger a form reset?
OH
reset()

hello,everyone

'lo pp

lo

: )

hehe

hey

I am a chinese,Exhibitions
no body?

hrmm?

??
what's the mean

it means 'what does that mean?'

no means
why did not speak

?
/join #linguistics

ok

my guess is machine translation

yes

which one?

his english is poor

because my english is very poor

i think u are robot.

a chinese boy

i run http://ajaxtrans.com
it does Chinese/English translation (rather poorly, but somewhat workable)

i think http://stardict.org is good

me too

hello.. anybody know where I can found a script for a countdown?

hello
input id="print" TYPE="button" VALUE="Print" onClick="window.print();"
is there a way to just print a single DIV?
http://pastebin.com/m716febea
i'm trying to print a single DIV
could someone let me know what i'm screwing up?
i got this code from a site online

replace "innerhtml" with "innerHTML"

embedded css style tag. How can i use javascript to change the font?

Is there a reason you are embedding the style rather than specifying an id?

that worked, but I lost all of my CSS formatting?

css? where?

yes, because we have a library of css that we normally import, this way i handle one-time special cases

well, i'm using a CSS file to do all my formatting
its not in the part that i sent to pastebin

Vme, it's on the 9th line at code you pasted to pastebin
and 14th

Under what condition will you be changing the style?
Directed to rook.

yea
that part worked

you should insert the reference to the css file in the html of the opened window
or browser don't know if the new window use css

would any of you seriously like to post "5 things you'd like to see in Opera"? if yes, i'm just gonna link to your blog if you are interested

OT (kinda)… Need a simpler (than the HTML select box) multi-select interface for a box that has some 600 items. Was thinking autocomplete but need the multi-select bit.
Anyone see anything that might work with that?

hey
i need A dynamically expanding form element
and generate id=".." in them

Well, rook, the answer is you don't need a lot. YOu can user the onmouseover and onmouseout events to manipulate the style elements of the tag. You can either create a generic function to handle each one-off instance, or you can simply use the same DOM modification over and over.

for instance.

cheers
it will be sent in the post aswell ?

Ah

input type= submit onclick="window.opener.document.font=Font('Arial', 12)

but i imagine thats tied into the dom which i dont know anything about?

try style.fontFamily

Ah i noticed font is not actually a translated word from css, is this correct?
whereas there is a pattern of taking a css word like foo-bar into javascript-ease fooBar ?

it's better to change the element's classes, so hat you don't have to put some of the CSS in JS

can a child change the parent's definitions of the classes
im not sure i understand you
sorry let me s/child/popup

classes don't have (machine readable) definitions
say you have a class called 'hover'
the onmouseover handler can put the element into the hover class, and onmouseout can take it out
then you apply a style rule that matches that class

is none of this trivial? i mean, do i have to learn teh DOM model and actual javascript
is this the kind of thing you are talking about http://onlinetools.org/articles/unobtrusivejavascript/cssjsseparation.html

yes, though I wouldn't use that function
better to have one function for each operation

so this is far from an short hack?

span onmouseover="addClass(this, 'hover')" onmouseout="removeClass(this, 'hover')"

lets say i'm in a public function how do i assign something to a instance variable of the object… do i just define the variable as in var whatever; at the top of the class and then call whatever = 22 or do you self or this?

what language are you referring to?

javascript
i've created a singleton object

what do you mean by "class"?

i.e. var bla = function() { return { init: function() { } }()
there not called classes?
they are*

no

well, whatever it is i'm just trying to work out how to get scope from say the init function to another internal function

if they're called through an object using the x.y(z) syntax, x is available through 'this'

awesome thankyou

http://developer.mozilla.org/en/docs/A_re-introduction_to_JavaScript

with grey text that disappears when you click on it?

hello… I'm trying to debug an app that isn't working. I'm not good at javascript at all but just need some help with something. Basically, there is an "Element" object that is supposed to load but isn't because window.Element exists. What is window.Element ?

same thing

you talking to me?

yes
window is the global object

ah.. ok
and what is Element then?

something defined by a library you're using, most likely

ok then. I just have one other question:
is there a way I can dump all the object's varialbes and functions?
actually nevermind

use firebug's console.log and click on the object

ah! Ok cheers thanks

i have a from page that I insert into my site in an iframe (dont ask why, long story). after the form is submitted, it should redirect back to a page on my site (not in the iframe). it does, but inside the iframe, but I need it to be in the parent viewport

parent.location = newurl;
But ouch, frames

iframe
not frames

Same concept, same issues, just differently positioned

auto, etc. iframe is useful when you have no alternative

inside your iframe you must access parent

There's always an alternative to iframes — complete site design at its worst.
s/its/the/
Sorry, 0711

with unlimited budgets thres always alternatives.

— then it's undefined. Is there a way I can make that function have access to my element.Window?

ChrisC35, hmm? Site redesigns are free (presuming you're doing the work yourself)
misc–: You mean window.Element, not element.Window? :-)
misc–: It should already have access
misc–: Perhaps it's defined onload, and Lightbox.prototype.initialize() is called earlier?

time = money = budget

no… before that declaration, it exists. Then all of a sudden it doesn't exist

anyways, how would I actiave that javascript in my php code?
when I want to redirect

But alternatively, frames = accessibility problems = lost profits (ha, ha)

maybe. It's something that should work though. It's off a Joomla component (well, mambot) and it works on the demo site but now when I install it on my site. I think it's a bit over my head

You can't, you'd have to write it out to a page.

ic
ok so I can just put that in the onload event of the page I'm directing to?
uok so I can just put that in the onload event of the page I'm directing to?/u

onload is later than it needs to be

what you said sounds about right though. initialize() may be getting called ealier. I'll check

element in the head

cool

no. It gets defined before the initilize() runs

just that? or do I need some onload event?
i'm not great at js..

No, you don't need any onload events.

scriptparent.location = http://styleinform.com/join-success;/script
i put that in the head
Twey ?
maybe url in quotes
it just loads itself now repeatedly

parent.location = "http://styleinform.com/join-success"; /script

Where, I should add, the join-success page *is not* the page with the iframe.

ya hehe i figured that out
made the interim page and it works
thanks

Welcome

hey.. i got simple array question: http://pastebin.com/m328e07ab

Im having trouble seeing the POSTS and GETs performed in my firebug, has anyone seen this bug

Anyone know of a Firefox Add-on that allows me to modify the navigator.plugins collection? (To circumvent lame-incorrect plugin-detection-scripts)

I shall write one forthwith.
I'm bored.

hi, i have… some table like tabletdtrblah/tr/td/table, how to access that 'blah' through window.document method?

good

bianchi, easiest is to just give the tr an id

Or even the td

and use the getElementById-method

Then use .firstChild.nodeValue.

you'd want to switch the tr and the td too though

what is the maximum length of an email address?

Oh - yes.

ok, work now!

255 I think the RFC states

I've just found this
The maximum total length of a user name is 64 characters
The maximum total length of a domain name or number is 64 characters.
So that would be 64+64+@ ?

= 129

ok great
And what's this?
The maximum total length of a reverse-path or forward-path is 256 characters
Oh yeah, the Fw:

i am trying to combine variables in a certain way….
var title=(document.getElementById("ned").which+title.value);
which containts "left_block_"
i am trying to make up a variable "left_block_title"
any help would be appreciated
i mean i am trying to pick up values from "left_block_title"

And now this is confusing:
the total number of octets that represent a domain name (i.e., the sum of all label octets and label lengths) is limited to 255.
So basically a domain name CAN be 255 octets, but a domain name in an email can be only 64
So if you have a domain that's longer than 64 then it won't work with emails?

so i guess i need the syntax for that
i tried "which"+title
no joy

any idea why xmlDoc = document.implementation.createDocument("", "", null); would not work in ie?

hey, i have textfield, now when i press enter on textfield it should do something, how to do it?

use keypress event

praveen can you do little example?

onkeypress=

now report should check if keycode was enter?

thanks, can i report what key was pressed?

onkeypress="change_message_label(this)

whats the equivalent for onload for i.e. 6?
xmlDoc.onload

yes you can ..

is script.aculo.us still a framework to rely on and use if I have to start out from scratch with a project
?

How to get all the hidden values in form ?

Im trying something pretty basic. I have a popup window which i want to close after 5 seconds and refresh the parent window
http://pastebin.ca/656693

The paste 656693 has been copied to http://erxz.com/pb/4030

Codes not working, any tips?

Fx extensions are weeeird.

why i can't see… elements in frame
i'v got var a = window.frames[0].document;
and thtat return HTML document
bud… a.getElementById("pop");
return null, even if I had element "pop" in that .html that is source of my frame

Fx keeps insisting it can't install this basic test extension I build by some tutorial because "install-???..rdf" doesn't exist, where ??? is three seemingly random letters and numbers which change every time I try to install it :-\

what's problem?

You can't access documents on other domains. It's a security feature.

is script.aculo.us still a framework to rely on and use if I have to start out from scratch with a project

script.aculo.us isn't a framework, it's an effects library

evrything is on local disk… source of frame is src="../html/test.html"

It uses the Prototype framework
Personally, I don't like it.

why so?

Prototype imposes a very specific method of coding on you and doesn't let you code any other way

i have lost connection, Twey have you said something?

It also tends to break other code due to the methods it adds to various prototypes
And it values brevity over readability, which is a bad thing IMO.

Is top.window.refresh() valid?

top.location.reload()

Ah, thanks

top.window is pointless, since it refers to itself… you could go on forever, top.window.window.window.window.window.window…

Most other frameworks do the same things, just pick one and go with it. IMO prototype is one of the more readable once out there

i have an overflowing div and inside that div i am doing some drag'n'drop action (not using any library). how can i detect if the user has moved an object outside the div and if its necessary to scroll automatically?

I have a "lightbox" type script setup and i want to refresh the parent window after i automatically close the popup

onunload="opener.location.reload();"

bianchi if you're really getting null, there simply is no such element. You could verify that by referring to the element in the context of your test.html

Comments

I have this one PHP script for uploading images that used to work but now Firefox asks me what to do with instead

I do not see why you'd want to serialize things here though.
you usually use a database library to manipulate the data in the database

MikeSeth, I need to print that echo statement while() there are row in the table "pm" that have the column "to" set to $username.
make sense?

e.g. with ORM libraries like Doctrine or PEAR DBDO you'd have, let's say, an Order class that has a save() or update() method that stores it in the database

nonetheless thanks!

np

MikeSeth, yes. that I know (although symfony is using propel).

first there's a bug. You do not reuse the first result of the query
I dont know anything about propel. But generally speaking, you should be using propel's methods to store the data in the database, not serialization

MikeSeth, what do you mean?

see $isempty? a line above it there's a call to mysql_fetch_assoc()

MikeSeth, uha.

configure: error: xml2-config not found. Please check your libxml2 installation.

then check your libxml2 installation

and at the end of my xml path is a fresh and new libxml2 install

oh…

it fetches the first result of the query. The pointer of the result then moves to the second result. The first one isn't used anywhere.

but there is no such xml2-config file

libxml2-dev

it is compiled from source - so no need for a -dev ? (or am i mistaken here?)

echo "option value=$j"; - that is correct? or is it echo "option value=/"$j/""

you need -dev for header and configuration files needed for building other stuff

it is compiled from source so you do need a -dev

i cannot find any -dev tarball - only for precompiled packages

uuuuh, it's a package.
at least on Debian

And I am saying I am installing from source - and thus there should be headers and such - no need for an extra -dev
:o/

does anyone know how to get php 5 to work with apache 2.2?
the php hosting module doesn't even seem to be being invoked.
well, its loaded but scripts aren't parsed.

there -are-, but they are not installed unless you do so explicitly
mime type problem?

aha, so this is a configure option to libxml2 to include the -dev stuff?
that would explain it …

to be very honest, I am not sure. I stopped compiling things years ago.

I would too if I was not forced to work on three different platforms - and I only have root one the one that cannot be updated online

"LoadModule mime_module modules/mod_mime.so" how does that work on windows?
application/x-httpd-php php
application/x-httpd-php-source phps
that should work shouldn't it
anyway goodnight

bugger - I cannot see any options to libxml2 configure that included headers and stuff

it's a make target, not a configure option
probably make install-dev or something

http://24.64.110.182/share/files/G-man/72238

$geboortedatum=explode("/","1/1/1979");
that should work?

hm

MikeSeth, it seems that it only prints the first word of the message.

yes, but please never, ever use non-English variable names

I'm sorry, I just pasted it straight form my code

then fix your code and make it a habit to never use non-English names or comments in code
open the generated HTML source and check that everything is alright

MikeSeth, sorry my line dropped. I think you misunderstand me. I know how to save a table entry. The problem I have is finding information on best practice regarding this use case: an order sheet is related to a campaign (a couple of tables containing, pricing, products, commissions, etc.).
now when the order sheet is created a subsequent change of the campaigns information should NOT reflect in a change of the order sheet.

MikeSeth, forgot the double quotes :P

for($d=1;$d=31;$d++) {
if ($d==$geboortedatum[0]) { echo "option value=\"$d\" selected$d/option"; }
darn
sorry

MikeSeth, thanks man.

Thought, that should work?
*though

I understand. I do not know how they solve that with Propel, and my favourite Propel wizard isn't around to ask. But, generally speaking, you would rely on the database's derived table features, or write a set of sprocs/triggers to duplicate data, and train your ORM to be able to work on the
materialized set

MikeSeth, what do you mean with 'derived table features'?

I don't think MySQL supports it, but PostgreSQL for example allows to define a table prototype and inherited (derived in this sense, not in the subselect sense) tables

hm, it is not a target to make
so no make install-dev
or similar

read the makefile, it has to be there.
http://www.postgresql.org/docs/8.1/static/ddl-inherit.html

the only mentioning of dev in the make file is /dev/null

What wrong with this code?
http://rafb.net/p/yxSjZU64.html

hello… I have this one PHP script (for uploading images) that used to work, but now Firefox asks me what to do with instead of displaying it. All other PHP scripts seem to be working, I even have a similar script that executes well. What might be wrong with this one?

It's not putting the select correctly

sbn, the code works for me

Realy?
Here it doesn't

sbn, what does it do?

It explode the string 1/1/1979 into geboortedatum[0]=1 & geboortedatum[1]=1 & geboortedatum[2]=1979

yes.. but what goes wrong?

and then It creates 3 drop down list
but it should auto select the 1979
but it doesn't select it

aha
I see

On line 21, shouldn't it be $j instead of $m?

ok thats right

oh, ok. at the moment I am using php mysql web hosting and we can't jump over to posgresql at moment

ok kuja you fixed it xD

MikeSeth, thanx for your help. I'll just store the non-changeable data in a subtable of the order sheet …

And for a select that is static (alwayse the same value, just html hosting no php) how can I add the select there?(getting the id out of db)

MikeSeth, me?

it was a /notice

MikeSeth, what is better about agavi?

its not ugly and not fascist

MikeSeth, hmmm, isn't that the first thing an ugly and/or fascist entity would say?

just because we're hell bent on market domination doesn't mean we suck

MikeSeth, … well I'll have a look at it when it reaches version 1.0 and the website is finished

API is frozen till 1.0, so any code you write today won't break until 1.0. And either way its radically different from other frameworks.

MikeSeth, so what made you decide to reinvent yet another wheel?

How can I do the fellowing?
http://rafb.net/p/rc4Xss63.html

none of the previous wheels were sufficiently circular
note, I am not a core contributor, I'm just an user
echo $bla['something'];

MikeSeth, but that (not sufficiently circular) is what every framework gives as a reason. it makes it really annoying to find the 'suitable' one

selected="selected" ?
#mysql-nl
Nederlands.

yep. And this one clicked.

MikeSeth, ok. I'll have a look at it. thanx for the info

imme but how do I do it? Since I've got static hosting information (the groupnames)

Hi to all
I need some assistence about a smarty issue. I have a recordset and I would like to create a list in a template in the table there are 3 records
I'm using {section name=counter loop=$data} {$data[counter].fieldname}{/section} and in the php side I've assigned an ARRAY $this-smarty-assign('data', $dataset); Why I see 6 records??!? but in the array there are 3 items

why are you using section?
section is tricky and is needed for advanced splicing. Why not use other loops?

Good morning all,
Is there a way to check if the module mod_rewrite is enabled in Apache via PHP?

hey, can you remove a specific element from an array if it exists? ie $a = array("one","two","three"); array_remove('two', $a);

unset($array[$element]);

wrong person?

pardon

section is tricky and is needed for advanced splicing. Why not use other loops?

thanks, didn't think of that

I have used also the foreach
but the result is the same

pastebin

ok

(notice that typically if you ask Smarty questions here you get yelled at)

http://pastie.caboo.se/81107

aha, the php configure requires xml2-config to be in PATH
I think that is it

hi, how can i configure php host to support tls as a registered stream socket transport?

you should use foreach. Really.

but the result is the same

var_dump($dataset); make sure the data is right; then replace section with foreach.

the data are correct

either way, paste the generated HTML too

there are 3 items
but in the loop appears 6 items
how is it possible?!?!

paste the html.

ok
http://pastie.caboo.se/81107
ops

it's the same item.

yes but updated

php oughta implement better session handling in php6

Howdy all.

any idea?

ola
whats your problem

hey sean`, claude_monet_imp
yes but updated what?
oh

I've updated the pastie

then something is wrong somewhere else, it is the template itself that's being rendered twice
still, switch from section to foreach

but it is the same

appears twice

This is clear
but why!?

http://php.net/openssl

I don't know, check your PHP code.

I'm going crazy
I'have checked many times

again, you are likely executing the same code twice.
post the whole source

it is yet all source code!

no it isn't I don't see you creating the template and rendering it

echo $this-ProcessTemplate('hostingplans.tpl');

ProcessTemplate?
paste the WHOLE CODE

yes
I have updated the pastie

I don't see the change

F5

http://pastie.caboo.se/81107 - this?

yes

nope, still see the same.
open a new one

I've added 2 row
ok
http://pastie.caboo.se/81111

hey anyone know a good class/function for two way encryption?

blowfish?
god damn it, stop adding single lines, paste the whole source

you can do that in php?

http://il.php.net/mcrypt

I have only 3 pages
one for connection, one of the php processing and one for the template
it is all
the code that u can see is all the code that I have

its a public host so installing MCrypt is most likely a nono

then I can't help you. The problem is likely in that ProcessTemplate function
bthen I can't help you. The problem is likely in that ProcessTemplate function/b

hash()

he needs two way

oh

you really dont want encryption calculations in PHP.
so if anything, use an extension

lol
it doesn't need to be ultra secure really
its more of a deterrant than real protection

claude_monet_imp, whats going wrong?

I'm using SMARTY engine

still. Use extension or not at all
he wouldn't post the source so we can't know

claude_monet_imp, i can see that. just explain ur problem in brief.

an extension, as in has to be compiled with php?

MikeSeth, hmm…i c

!+typing english

##PHP does not allow aolbonics (or leetspeak) such as u for you, r for are, ic for i see — etc and typing like this will result in you being silenced; furthermore, inability to adapt may result in a ban.

yes.

can't

smarty write the output twice

then I can't think of anything good to advise

claude_monet_imp, ok

claude_monet_imp, are you exec output twice?

it's not smarty. It's the code you won't post.

I'm looking the template in the cache of the smarty

fine
so why shouldn't i do encryption in php?

slow

claude_monet_imp, http://pastie.caboo.se/81111 - is that what you're talking about?

yes

well I'll write a simple one I guess

http://pastie.caboo.se/81113

:|
just to obfuscate, lol

yes and there is nothing wrong with it. The problem is not in Smarty, it is IN YOUR CODE

claude_monet_imp, check the loop in ProcessTemplate function. Its executing twice. MikeSeth's right.

http://pastie.caboo.se/81114

Whaddyamean? Smarty is a problem by itself :P

yes, but he really can't blame it.

Damn.

claude_monet_imp, or the problem must be in the while ( while ($dbresult && $row = $dbresult-FetchRow()){$dataset[] = $row;} ). I'm pretty sure $dataset has a null row along with the result.

WE DONT WANT YOUR CACHE OR YOUR QUERY. POST THE SOURCE FOR THE FUNCTION

hey

twice in the output?

look at http://pastie.caboo.se/81114

MikeSeth, yes. i see so some loop is incorrect or the elements in some array are duplicated for some reason.

and he wont post the source to the code that is broken.
I am getting tired of this

claude_monet_imp, why cant you post the ProcessTemplate function?

I'm looking for it
the project is not mine

claude_monet_imp, so you have the source but you cant find the function? :O
MikeSeth, hehe.

$dude = 'basix'; unset($dude);

hi

hey mcbane

I have some trouble utilizing sessions. I have made up the following testscript: http://pastebin.com/d4b988bd5 from what I have learned, it should increment the value eatch time I reload the page. But instead it is allways zero. Can anybody help?
cookies are activated at the client machine
and I have tried Safari and Firefox, so it shouldn't be a client side problem.

without looking at the code, have you opened a cookie in the browser to peek what's in it/

a cookie is created at the browser and it contains the session id

mcbane, I am not sure if a variable is considered 'set' when it is false
try turn 0 into '1'

isset() would return false when variable is 0
so you are in an infinite loop of sorts

0 doesnt mean the number zero, but means boolean false.

I did. Now I get allways "1" in return if I reload the page.

correct me if Im wrong

you're wrong

Solved!

I am.

thanks guys

I just checked.

thanks

what was it?

isset only returns false on NULL

I am wrong.

I have written two time the same row :P

could there be a connection between the fact that php is running as cgi and not as module in apache?

when we invade your country, I'll make sure to take away some of your valuable properties
nothing is impossible. var_dump($_SESSION) right after session_start()

that gives me the following output "array(0) { }"

mcbane you dont close the browser in between reloading right?

no I don't

just checking ^^

I will do the same :P

then your sessions are probably not stored.
ask PHP where it stores'em

I have to ask the central department for electronic stuff at my University. Thanks for helping me to round up the problem.

will php_info() tell that?

phpinfo(), yes

nice, one moment

if you university doesnt support sessions you can always do something with cookies/db

I currently develop an application for teaching purpuses in medicine. They currently set up the server (we have to migrate from php4 to php5). It won't be a problem to get session support. I gues they missed it when configuring php.
session.cookie_path = "/"

alright

is that the path where the cookie data is supposed to be stored?

that is root I believe, I dont think they should be there
how is / called?

yeah, the user, who is running php host does not have write permissions in there.
I don't understand your question (I am not a native english speaker)

I thought the '/' folder in linux is called root, but then I was confused because the 'admin' account is also called root

yeah, root as user and the file root.

ok thanks

hello, has there anyone experiences with unpacking and working with RAR and ZIP archives through PHP?

Thank you very much for helping me out. I really appriciate it.

hey. im looking for a similar function to is_date() but i need to check if the time is ok (hours minutes secounds) … is there a somthing ready for it or i need to do if $hour is higher then 24 …

24)

and what about hours, minutes secounds?

php echo date("g:i:s"); ?
but ull need to convert to unix timestamp before comparing

G its means that if the whole time is ok in unixtime?

no g returns just the hour
http://uk2.php.net/strtotime
read that

60)

like that?

thats if the current minute is more than 60

Hello I am alter a validation to be a bit stronger. I have a 'datefrom' and 'dateto' (for a vacation script) which should be put forward as dd-mm-yyyy. How can I check that it's formed like that? At the moment, I'm just using if ($_POST['datefrom']=='')

strtotime, checkdate

teach, date ('d-m-Y', strotime ($string)) == $string
the date params should be others I think

$var = 'test' and then echo $var = $var ?

huh

hm?

$var = "test"; echo $var; ?

jerryrozz, tethink/rephrase that
you need variable variables, i guess

i will that he echo the name of the variable in this case $var

thanks

echo '$var'; ?

test

yes, so echo '$var :'.$var;

$value) { echo $item . " - " . $value) }

that should work i think :/

foreach $ ??

duno
ive never tried it
i might work
it*

afaik - nope

let me try

echo '$var :'.$var; willwork

AlexC_, logic says to me that $ should ben an array
Do you lack logic?

yeh variables are formed into an array

and MrWilson you do know you can't call $.. as it's an unexisting variable.. also you cannot set it

sean`: do you lack logic? $ will not work.

i dunno like i said it was just a guess

foreach($_GET as $item)
{
echo 'name:'.$item;
}

jerryrozz no

if you want to do that, MrWilson and sean` then use get_defined_vars()

$val) { echo $item . " - " . $val }

will list all the GET variables
that definatley works cause i use that in my script

He was speeding up the code, and used $ as a quick way, so I see it as valid, since it's just an example

hello

or he just did not know about not being able to use $

after I've posted form data to another page how do I then 'get/echo' that stored info?

sean`logic tells you that $ will work because it's an example?

cause any decent PHP'er will know that $ should be a REAL variabel

Thanks MrWilson

rick111 using $_POST['formid'] or $_GET['formid']

it works

as they by default should know that $ is a variable you cannot use

ohh thanks, did try GET, will try POST, cheers

sean`: then you miss understood what MrWilson said and what I said in response to that - he was wanting to use foreach( $ as … ); like that - by just using $

yeh
as in listing all varialbes in the array

for which you would use get_defined_vars() for that scope

foreach $ ??, which was quoted from you.. also invalid syntax, as you're not using parenthesis.. but we don't confront you with it do we?

yeh that works to AlexC_ lol

sean`: haha, bless.

guys, i was just givin a short example

cause logic tells us it should've been foreach ($ )
MrWilson, we know
we're just an active crowd

lol

post worked, thanks MrWilson

sean` you seem to like this Logic word, yet also seem to have none

yw rick111

AlexC_, you are so right *thumbsup*

anyone know what do i need to do to get PHP Command Line working, it's just displays and doesn't run a pl scripts

uhhh… pl != PHP

how to enable curl over php5/apache2/windows - xampp ?

shell# cd /usr/local/atmail/webmail/modules/ ; php migrate-pop3.pl /path/to/pop3users.txt
this is what i need to run

then use the proper languasge? Like Perl?

php migrate-pop3.pl
take out php and put perl
perl migrate-pop3.pl

spoilsport…. It shouldn't take a rocket scientists to figure out that one…

lol

hi all, i was here yesterday, i have php code that works on one server and not the other. the code is http://pastebin.com/m7f21179d . and the line is $manager_str = $this-session-get($this-getSessionKey()); (442). the type that goes in the function is
Services_Yadis_BBSession Object.. i am not sure whats the problem

so tell me guys, after i change php.ini under windows, what to do for it to take action of the change ?

were you looking for me earlier?

MikeSeth, yeah, yestarday

I was owning AI in galciv2

PHPadam, restart apache?

GuySoft, i realised i was editing the wrong php.ini file, i had a few

afaik you dont need to restart anything to apply changes to php.ini

um, yes allways make sure you are on the right file..

owning AI in galciv2 ?

but i'm not absolutely sure that's the case

GuySoft, i was on the right file apache wasnt

robert_, i needed here on debian.. maybe i am strage

yeah. It's a kick ass game!
you won't be an IGLU member now would you

PHPadam, point of view..

GuySoft

MikeSeth, i would ..infact i came here for help connected to the JLC server

oh.

i installed an openid modeule on the phpBB forum. and it works on my localhost.. but it wont on mirimar.net .
MikeSeth, i can't figure out what is disabled there.. did you see what i typed above

hi

?

hi, anyone experienced with phpmailer()? If I'm in shared environment and use phpmailer's smtp method. Will it be using mail() function inside the code that use cgi's sendmail or any OS's mail delivery function ?

generally speaking, we do not help people with phpbb host here. Either way, "doesn't work" is not really a fruitful description
SMTP means SMTP. It doesn't mean sendmail.

GuySoft, yeah, dont use it, cause it aint working

!+mail()

mail() is, like, virtually useless. It's really easy to misuse it to open a security hole, it doesn't provide any advanced facilities for character sets, attachments, etc, is problematic across platforms, and its direct use is discouraged. Instead, pick up a fully fledged mail
library.

well how about it stops php.. i get a blank page.. i located that line because "echo hello;" works before it, but after it it wont execute that

excute that?

mak sure display_errors is set to on in php.ini; set error_reporting(E_ALL); check apache log for error messages.

execute an echo command
MikeSeth, i carn't change the php.ini configuration, even with ini_set
i can see it thaugh
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT .. show all errors, except for notices

do you get an error?

Why do you need the last part?

MikeSeth, ill try now.. just did you get what i was saying about 'echo'?
i pasted the comment too

the typical blank page problem is caused by a fatal error/parse error and display_errors set to off. This is how you diagnose it. If it's not that then you would have to trace down where PHP stops.

MikeSeth, i did trace it down..

oh you pasted a link
one sec.

MikeSeth, if i echo before the line i pasted, it shows, if i paste after, it does not

php
$adizayn = htmlspecialchars(trim($_GET['adizayn']));
if(isset($adizayn ) AND $adizayn =="hakkimizda" ){
include ("hakkimizda.php" );
if(isset($adizayn ) AND $adizayn =="kampanyalar" ){
include ("kampanyalar.php" );
}elseif(isset($adizayn ) AND $adizayn =="referanslar" ){
include ("referanslar.php" );
}elseif(isset($adizayn ) AND $adizayn =="iletisim" ){

pastebin MAsterTURK!!

uhhhh

include ("iletisim.php" );
}
?
where is the problem?

nice one. Use a pastebin

between the chair and the keyboard.

Comments

I have a php script running on localhost and i want it to create a file in a folder in my desktop I have set the

so means I need to tear of "Other Server" from my figure… thanks guys

php - by retards for retards… Im so happy to write next project in c++ or java.

yay, one less whiny 12 year old php programmer

is it normal that changing locale brakes code (make code not compiling)?

no, calling function incorrectly and changing locale

make code??
geez

incorrectly?

the manual doesnt say FILE_GET_CONTENTS or File_Get_Contents it says file_get_contents

and?
thoes are build in functions, I ment own functions

and thats it

btw, this is funny as most for-dummies languages are case insensitive

if you define them capitalized, and they don't work capitalized, then you screwed up
make sure you didnt change anything along with the locale

yes I know how to fix it probably
set locale right at start
but this is a major WTF
its more lame the visual basic using case insensitive version of XML to communicate with a object pascal macro

submit your bug to blackhole@php.net

ur so funi.

just wondering, what function are we using to set locale?

setlocale

then lets try break some capitalization

hm?

this may be a wierd question, but is there a way with php to change for example A into A
if there is no built in method, does anyone know of a table to look those up perhaps?

why are you doing this?

no problems at all

hm?
set locale to TR_tr
tr_TR.UTF-8 for example

you mean to get the ascii code for a? or what is 65?

poutine, a stupid reason, I have written a serverstatus page, and someone wrote a program to crash servers that parses the IPs from my page, so if I 'obfuscate' them like this, it will break the server crasher

fix the serverstatus page…

nope

turning 1 byte into 5 bytes won't help anything

functions work with any case

sure rolfen, how can I get the ascii code in php for a given character

no

I will not answer this question, this is a silly solution

I am open to all suggestions poutine, how else do you suggest I stop this parser?

if you think you have to "obfuscate" things to fix them, you've got some other problems

well common, dont talk about silly solutions - we ARE using php anyway.

moparisthebest, Explain the problem fully
how are they using a program to crash your server?

ok poutine

let me check… i think there's a way

of course there's a way

http://www.moparscape.org/serverstatus.php

look into char() or sprintf()

anyone can post thier private server on it
and someone wrote a program to parse server hosting IPs and ports that are online and crash them
*attack them

see orp() : return the ascii value of a character
oops

ord

i mean ord()

it works in simple case. Btw I set locale in one of includes perhaps that contributes to the problem

ord rolfen menad

so they dont crash my server poutine, just people who advertise on my page

moparisthebest, So how will doing this work?

they crash people? call police

It's easy to get an ascii value from a number

but it will cause the parser to be re-written

not really
maybe 2 lines of code

heh, those crappy server crash themselves

if it's in PHP, all it'd take is one function call

s/"ord rolfen menad"/"ord rolfen means", lols

well, he released a binary to a lot of people
so all of those will be obsolete

You can'
t protect the world
caution the people who own the servers to secure them

I have banned him a few days ago, hopefully he already got bored of it

this is silly

I have already done that, they are too sorry to do so and whine to me, I get tired of it
this will break the first crasher that has been released, after this it is up to them

they show no other common behaviour?

randomly replace letters in the ip with html entities

what do you mean TehSausage ?

so, how to fix uppercase-locale problem

iterate through each string, rand(1,3) then get the value of it and replace with &x**;
i forgot the syntax for html entities :P

thanks for the suggestion, but I dont want to show all of my cards just yet
ill do this first, if he comes back with an updated parser then I will add that in

can I make php to stop fucking with function names cases
and just call exacly the function which name I written?

ah, �X;

does anybody here know anything about custom rss feeds tailored to the user? this would require the user be logged in, correct?

ah, yea TehSausage that is exactly what I was working on

i shall write a function for i have no life

just writing a method to change a whole string into that type of thing right now
that would be much appreciated, because I was still thinking of how to go about it

by definition since it is tailored per user that user must be logged in (or otherwise fingerprinted)

done

wait, TehSausage what about http://us.php.net/htmlentities
done already?

that does only the characters it needs to

tag and have a wild card like "body *"?

http://sausage.no-ip.org:88/tiamat/test

preg_match Kai_wp

I am using a session save handler to save users sessions in the database. Does anyone know what encoding does the data get stored as ? I am having a hard time get the data out in the right format to display a list of online users

very much appreciated TehSausage

it fails to recognize some of names dunno why. For example functions of class

the session itself is stored serialized…but it's best to separate out the data. For example, create another column on the session table (session_member_name or *_id) and populate that ONLY if they are logged in. At that point the SQL would be trivial to pull the list back out.

I read the PHP documentation on Preg_match but I'm confused as on how to use it.
I mean how do I specify a wildcard?

ill show you an example

learn PCRE :P

Bobby_Easland, so if I unserialize it I should get arrays of data ?

Kai_wp, if (preg_match("@/?[^]**@", $name)) {
echo "The name cannot contain HTML.br /";
return;

I don't recommend that method but it would work. Remember, that is a lot of overhead pulling each row then unserialing the data to get at one value

after changing locale, php doesnt recognize some of the functions/methods (randomly) how to fix it?

Bobby_Easland, I need to get several values… well actually the user id and the page they are viewing. I tried unserializing it but I still get some random character string

I understand that is sensitive data but if you could post an example (maybe strip the sensitive stuff?) it would help a lot

http://www.mininova.org/tor/791777, its a torrent containg an e-book
an e-book titled: Teach Yourself Regular Expression in 10 minutes. Its an easy reading.

well that was smart, i made the user apache, gave it permissions to the www folder then started apache as it

$record) { echo "{$record['SessionValue']}br /"; $array = unserialize($record['SessionValue']); print_r_pre($array); }

then i realised i forgot to give it permissions to apache XD

The locale information is maintained per process, not per thread. If you are running PHP on a multithreaded server api like IIS or Apache on Windows you may experience sudden changes of locale settings while a script is running although the script itself never called setlocale() itself. This
happens due to other scripts running in different threads of the same process at the same time changing the processwide locale using setlocale().
^— incredible O_o
This is trully amazing, how broken setlocale is….
is there some way to use gettext without this broken setlocale function?

that does seem messed up raf256

that is totally beyond any limits of incompetence and lamenes… who the f… designed that part of php

the great thing about Open Source Software is that you…YES YOU…can jump in and help make it better. Simply stop complaining about your perceived deficiencies with PHP and start improving the source code…

http://www.moparscape.org/serverstatus.php
raf256, the same person who introduced the triple equals sign === ?

well i assume their idiots who will spend weeks breaking your "encryption"

probably

shure, rewritting php its the way to fix my for-yesterday problem with "just get the locale working"

however ive found the way to deal with these people is to keep throwing up obstacles, eventually they just get tired and go away TehSausage

"no, sorry boss I cant" "why not" "because some totall idiot designed php and broken the setlocale beyond ANY BELIVE"

notice I didnt convert the port to entities yet

so… I would need to have TWO SERVERS one for each locale? lol…. :/

ill do that after they fix the first part :P

heh

raf256, there has to be some extremely dirty hack around it
there always seems to be some extremely dirty hack that can be used with php

how the hell can be set locale so terribly totally fucked up
if such a moron would work for me I would fire hiss ass immeditallelly.

I tend not to say the word "no" for any technical request from my boss…even if that means having my engineering staff (or myself) write custom extensions or modifying the source code

well, after smacking him on the head

raf256, personally I have never tried it, but I have heard nothing but good things about java web scripting

i have a php file i named config.php with some variables in it, i included it on script that has classes that take some of those variables, but it like it doesnt see them.

I would be hapy to write un-fucked-up version of 1) gettext 2) smarty
but that takes weeks if not months (incl. testing etc)

I think you have to declare them global in the imported script evilx
sort of import them?

we are 90% done of a project and now this raging incopetence of retarded php developers cames up as un-passable obsticle

wierd, because if i include it in a different script, it reads them fine, but i guess it might just because it a class tryin to use them

ah, well that wouldn't be feasible then to switch languages
never messed with OOP php evilx, ive heard nothing but bad things about it :/
raf256, locale changes things to different types of encoding correct?

the ability to solve the problem you are experiencing is exactly what separates script kiddies from coders…coders from developers…and developers from engineers. The bottom line is how each would aproach solving the root issue (which you have not identified yet)

*things == text

as I said and you chooed to ignore, I know how to solve this. But not it one day.
as it would require fixing part of a huge, fucked up, project (php itself) and that isn't trivial

why not make them all lower case and do a global search and replace

setlocale just doesnt work
because idiot stallman (gettext) fucked it up, and php devels based on that broken tool (AFAIK)
I need same script to be in locale say EN or say TR different for each query (each web user)
when I wrote own translating system I simply set a $lang and make my functions use that

moparisthebest, i just went back to making them with define(), it seems to work and they are static set variables anyways.

but here I must use setlocale to tell gettext (and smarty translations) what to use, and setlocale is borked

might be the easiest way to do it evilx

weird, gave apache read access to the whole partition and now it starts :P

how are you implementing your exception handling for that setlocale()??

Im not, why

I would think it's obvious at this point since you've been rambling about it nonstop…the reason is to detect and make actionable an exception

setlocale doesnt fail
it "works" but in addition it makes php not recognize some functions

setlocale will return a boolean false if it fails (i.e. - locale does not exist on your system)
that should have been the first thing tested…

it returns true. and/
it returns true. and?

it does not return true

tr_TR.UTF-8 to be exact
it doesnt fail, as I written
but instead now it fails to recognize some function names

geez

huh?
well.. do you have any helpfull comments on this issue?
Call to undefined method User

Comments

oh no I mean the script is from an outside source which I have no access to diggcom its writing about 5 lines

I am learning javascript and DOM, however the document object is confusing me a bit.. because they talk about it in javascript reference on netscape and in the mozilla developer documentation
I may have asked the question twice, sorry. but I am not sure if it was sent the first time since I wasn't authenticated yet

I can't run scripts on the server, all I have is plain html and a formmail.pl script

hello all
When assigning functions, is there a way to specify the parameters also?
rather, a way of specifying the parameter values

gregorycu, nope
but javascript hosting functions can be called with no params, even when function declaration includes them
function test (foo) { if (!foo) foo = "bar"; }

http://pastebin.ca/610465

The paste 610465 has been copied to http://erxz.com/pb/3496

luckiily it copied my description with the question in it too…
nope. it didn't. nice

can i update a div's content - which's parent page's div - from iframe?

is the document object considered part of javascript ?

yea

fearphage, but it is also in DOM, I am confused

you're operating on page's DOM tree in JavaScript
http://developer.mozilla.org/en/docs/About_the_Document_Object_Model

insin, can I say that DOM expanded the javascript document object ?

from what I can gather, javascript is the language, the DOM is one of the things the language can act on

the DOM specification defines how the DOM should work - javascript hosting has an implementation of that specification

insin, aah this pretty much clears my confusion
insin, but why there is nothing about document object in ecma specs

because the W3C defines the language binding for ECMAScript
http://www.w3.org/TR/DOM-Level-2-Core/ecma-script-binding.html

thanks a lot. checkign it now
insin, so you can say that the DOM specification is a specification for the DOM interfaces (classes, and structure) and appendixE specifies hows these DOM interfaces are implemented in javascript ?

i'm having some trouble loading xml data into a local script that has been rreived from a remote domain
when i alert responsetext i get the XML data
but i can't seem to access it via responseXML
nevermind, i did it
i DEFEATED THE MAC
by parsing the responsetext
AAAAAAAAAAAAHHHHHHHHHHHHHH
someone please help i'm going to go insane
i'm making a widget for the mac. it uses safari to render the html hosting in the widgets.
the html works fine in safari
but as soon as i load it as a widget it no longer works
it is a local html/javascript file that loads remote xml data and displays it

if you're saying that it displays fine in safari

yeah

then the chances are, it's either not a js issue

no errors and it displays the xml data

it's an issue with your widgit controller / displayer

is anyone here familiar with mac widgets???

I'm trying to load a json reply into an iframe (building a multi upload thingy) .. sending it as application/json or application/javascript works in all browsers except IE and older versions of Mozilla, sending it as text/plain works in all browsers save Safari .. any common mimetype I could
use that would work in all browsers?

and with "work" I mean that it doesn't pop up a save as dialog for the script file when the iframe loads

hi
my_var = (char)65; and then, my_var will contains "A", is it possible ?

String.fromCharCode(65)

A

thanks, I'm going to try it

Ok, so how does the Element know that it needs to update itself?

insin, and then if I want "AA", I need to do it char by char ?
or there is also a fonction

you can use regex

??
how N
?

that's a cue for some googling :P
regex is a way to say "does that string match this pattern"

mmh…

and such a pattern you want would look like \A{2}\ i think
haven't done much regex for a while

what are you working with, a list of numbers?

insin, yep

you'll have to do it char by char, yes

ok
thanks

if (!Array.prototype.map) { Array.prototype.map = function (f, obj) { var l = this.length; var res = []; for (var i = 0; i l; i++) { res.push(f.call(obj, this[i], i, this)); } return res; }; } [65, 65].map(String.fromCharCode).join("")

A

argh

Ok, so how does the Element know that it needs to update itself?

does anyone know how to delete properties in javascript?

is there another way to do a s = string1 + string2; without using a "+" ?

No. Why?

Jan-, a very special case… I need to do a cat, but I've no way to use "+"
there is no strcat() or similar ?

You could always write one.
Why can't you use the addition operator?

Jan-, yes but in the fonction I need to put a "+"…
Jan-, I'm trying an XSS attac

Why does it matter?

but the script is protected against "+"

foo = 'bar'; wibble='foo

Jan-: Error: Error: unterminated string literal at line 0: foo = 'bar'; wibble='foo

foo = 'bar'; wibble='foo'; foo.concat(bar)

Jan-: Error: Error: ReferenceError: bar is not defined at line 0: (null)

drat
foo = 'bar'; wibble='foo'; foo.concat(wibble)

Jan-: barfoo

there you go

thanks a lot

doesn't modify the original.

what ?

hello

in that example, foo is still
in that example, foo is still "bar"
it just returns the concatenated values

could any body tell me how can i get border width with dom (element.style. )

What sort of border?

foo = 'bar'; wibble='foo'; foo.concat(bar); foo

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

foo.concat(wibble)

oops, copied the wrong one

element border , like #id { border: solid black 1px }

foo = 'bar'; wibble='foo'; foo.concat(wibble); foo

bar

foo.style.border='1px solid black';

^^ this is what Jan is pointing out

and for getting only 1 for 1px ?
is there a way ?

I'm not sure what you mean.

for getting border size in px

you want to get it or set it?
Getting it is hard if you have set it in CSS.

i have set it by css …

It can be done.

and i just want to know it (not setting it)

But I don't know how. Try googling for getComputedStyle
That's the IE way to do it but I don't know about firefox.
There may be a library for it.

exec('var lol="foo";'); ?

ubitux_, wouldn't it be eval()?

eval(), that's it

ERROR: syntax error at (eval 259) line 2, at EOF

thanks
huh ?

if a piece of code randomly generated assigned events to objects throughout a page, then those items in the page are deleted or over-written, how can the memory for those events be cleared up?

mmmh I think that's not the function
exec("alert('lol');");
do you see what I would like to do ?

you're looking for the eval function, I can see *what*, but not *why*

another way to bypass the protection I have
eval works ?

ERROR: syntax error at (eval 259) line 2, at EOF

buubot, so wtf ?
erf
I'm talking to a bot…

eval 1+2+3

6

I see :p
thx
it seems to don't work

missing ) after argument listSource File: http://www.gigdates.com/venue.php?id=6967Line: 65, Column: 47Source Code: map.setCenter(new GLatLng(+41.878249,-071.369899), 15);
why am i getting this error
the green arrow is pointing to the . in the - value

DavidHKMrPowers, I don't know how I can use it in my script
var myvar="alert('lol');"; eval(myvar);
for example

oh i know
it doesn't like the plus

oups

how would I dynamically load an external JS file (instead of always including it in the page)

it works :/

grrr this is not it
this is going to have to wait, i need to SSS and go to work

tag from within javascript?

i would say you could load the css page using ajax

http://pastebin.ca/610716 - why am I said that the function is not defined?

The paste 610716 has been copied to http://erxz.com/pb/3497

document.getElementById("whatever") — but this returns undefined

also if I try to use document.form[0].blah it will also be undefined, as will document.formname.blah
I'm going crazy because this is such a simple thing and I can't seem to get it working…. and I need to have it done asap - can anyone please help me out?

the first thing to check is that the ID is unique

it is, 100%

then ensure your form is correctly introduced in the document (not between a table and a tr)

the only tag above the form tag is a div
So I think that's a 'check'

give a link to the test url

Unfortunatelly it's an internal employee portal thingamajig i'm developing
I don't really have a test URL

then this leave the last option

pastebin the code?

well if it's not too long

It's not, it's mostly HTML anyways
The javascript is about 5 lines

i was about to say "pray for someone else to come)… but your idea is correct :P

Here you go http://pastebin.ca/610828

The paste 610828 has been copied to http://erxz.com/pb/3498

I took out some of the content in terms of users and usernames from the table as well as the company name for privacy issues
but it shouldn't affect the outcome as there's no forms or id's inside the table
Also I just noticed that I had a mysql query in there which I was using to debug, which contains the characters "" and "" but this problem is still there after I took those out
Just throwing it out there….

the only thing i see is the form that don't have an action and method… and then may not be considered a correct for by the browser (guessing) but that's no reason not to select the element by id

Let me try giving it one… by default it should 'post' to itself which is what I want it to do

Arcanimus str_replace("", "<", $myresultvalue)
OMFG
stupid me

thanks, I know :P I just forgot to add it when I was debugging

i know the problem

Oh?

your JS is executed before the body is loaded
wrap that in a function and call it in body onload="myfunc();"

yeah that's what I was just thinking
thanks 3
Let me try it right now
erm.. no luck
also I was just thinking to myself that it wouldn't solve the problem because I'm still getting 'undefined' when I evaluate the statement in firefox's javascript error console

still says "box" has no properties ?

yup

repaste the new code

okay one second
http://pastebin.ca/610841\

The paste 610841 has been copied to http://erxz.com/pb/3499

err http://pastebin.ca/610841

The paste 610841 has been copied to: http://erxz.com/pb/3499

do you know of FireBug? http://getfirefox.com/

I left the inside of the table, just changed hosting company name this time - fake users anyways

er, http://getfirebug.com/

never heard of it

well beats me
but you might want quotes around the left hand operand here #
if(box.options[i].value == usercreate) {
#

Yeah it's totally strange… even has the same problem in MSIE
True, *adds it in*

erm
right hand
q2HIO`

Oh my god. that worked
Thanks for catching that
I don't know why the box was undefined
but for some reason it works fine now

firebug would've catched it

*caught
:p

oh
thanks
past tense exceptions…

np - thanks for the help. I can't believe I was wresting with this for like 40 minutes
my boss won't be too happy I wasted so much time on it but oh well
such is the cost of debugging
later guys

guys I forgot, where I change the system global variables like [ from java , etc ] ?

is there a javascript validator somewhere?

the what?
if the syntax is bad, the script will be ignored

like the var from java host to make it global
where I change that ?

change what?

the global vars

can you give an example of what you mean?

i thought was env
on command prompt but that´s linux i think
*in linux

in javascript?

no

hi
need a little help..
i want to know the FULL URL from ths "Get Results" Button
http://www.nseindia.com/content/equities/eq_scriphistdata.htm
i want to use bash script to get server data..
is it possible?

does anyone have an idea what this might be for:
http://www.js-x.com/page/javascripts__example.html?view=847

Is there a way to detect what segment (#…) the URL bar contains?

yes, hold on
window.location.hash

oh, thanks!
:-)

hey everyone

Hello! Is there a way to list all the current attributes of an object?

hm
you can list through all of them manually?

I don't know them in advance

search for print_r for JavaScript, maybe

ehhh
idk

ok, I'll try

http://www.phpbuilder.com/board/showthread.php?t=1029426
ack
invalid, wtf

for (i in obj) { i is name attribute, and obj[i] its value }

THANKS!!!

hi all
wymetyme?

hello everyone, i am trying to write OO javascript hosting function and when i try to access a attribute or a function of the object from inside the anon function, it says its not defined

"ohreally" at 71.6.194.243 pasted "says showerror method is not defined" (18 lines) at http://erxz.com/pb/3500

http://erxz.com/pb/3500
anyone?

document.content_right.style.height = document.content_left.style.height — if i have two divs with those respective id's (content_right, content_left), should that work in making their heights equal?

use document.getElementById(content_right).style.height
that's your better bet

thank you, but surprisingly still won't work

.

try storing it in a variable and then assigning it
you can then atleast debug if you did get a value
i have had this problem but trust me i got bigger problems at the moment :
bi have had this problem but trust me i got bigger problems at the moment :/b

well, alert(document.getElementById(content_left).style.height);, gives me absolutely nothing
could this be because i defined the height with css and not inline using height=""

yea i have had that problem before
i dont know what the solution was
think all i did was bang my head on the wall

and that worked?
IE, amazes me every time…

so anyway did anyone get a chance to look at my jscript?
http://erxz.com/pb/3500
i get error, i says the functin is not defined

for future reference: javascript!=jscript

but when i run it seperaetely it all works fine
yea yea shoot me

lol sorry, just sayin

Why does IE not like addEventListener/removeEventListener
?

sorry, kinda pissed off with JS and css problems all at the same time
addEvent
that works fine

`js addEvent

function addEvent(el,ev,fn){ if(el.addEventListener) el.addEventListener(ev,fn,false) else el.attachEvent('on'+ev, fn) }

`getElementById

any idea how to pass parameters to the method called in that?

`js getElementById

addEvent just implements addEventListener
I have a page in IE that is erroring on every instance of add/removeEventListener

to addEvent or to its "fn" arg?

you talking to me?

insin to its fn arg. I have a number of elements to which I want to attachevent and the only difference is the id that's pass to attachEvent, but when I use function() { doSomething(args) } the operation is always performed on the last instance created
to me

okie

use a closure

a closure?

function exampleClosure(arg1, arg2) { return function() { doSomething(arg1, arg2
whoops

urgh, this is getting messier and messier
inline is almost tidier

function exampleClosure(arg1, arg2) { return function() { doSomething(arg1, arg2); }; };
addEvent(el, "click", exampleClosure(arg1, arg2));
not messier, new conceptier

messier

can anyone see something wrong with this? :
this.main = document.createElement("table"); document.body.appendChild(this.main);

`js closures

http://jibbering.com/faq/faq_notes/closures.html or http://blog.morrisjohns.com/javascript_closures_for_dummies

thanks, looking at the first one right now. Looks…. like work
hold on, if I have evAdd(field,'focus',function (){ clearFormField(this,fieldDefault) },false); is that not already a closure?

no, all your functions reference the same variables, which is why the last value assigned to it used
*is used

ah, so I need an extra one?
urgh

s/urgh/powerful!/

s/powerful!/work and inelegance!
there goes my plan for one global js file
loading up on pages alone will be a lot!

it's not really that much extra work - you could write a generic function which lets you define the event handling function an its args

hmmm, true
although, I kind of have that, it's just extra layers on that now

it could use http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Function:apply to call the handler with some args
it could use a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Function:apply"http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Function:apply/a
to call the handler with some args

why can't I appendchild to the body-element?

can anyone help me writing OOP javascript, i an unable to access a method or a property form inside a function of a object

can I only do that onload and not in the row before /body?

is there a way to perform a function every time the browser window is resized

yes you can register the even window.onresize = myboject.foo

`js removeEvent

guys cmon' help me out, i am really stuck with this javascript problem

what's the inverse of addEvent?

thanks

its node.removeEventListener(eventType, function);

can i put the window.onresize in the body onload=""
?

excellent tutorial http://www.brainjar.com/dhtml/events/default.asp
i would suggest to keep the events seperate

that only works in FF
not IE

el.detachEvent("onmouseover", highlight2);

I guess I can write one real quick just like addEvent

word thanks

so anyone with OOPs javascript skills

http://rafb.net/p/6Vwhzn26.html anyone can read: wont work the line 36…. the function is called from onsubmit…. any advice?
a href="http://rafb.net/p/6Vwhzn26.html"http://rafb.net/p/6Vwhzn26.html/a anyone can read: wont work the line 36…. the function is called from onsubmit…. any advice?

Mmm.
Curry.

brr

.href is missing

charming

Jan gets dark purple

window.location.href

Huh?

I'm color-coding all of the IRC people

the addEvent that the jsbot spit out doesn't work in IE7
the function that is

Oh. Why?

can someone tell me how to get the javascript sort( function() ) to work in ie7, or a workaround?

Jan-: Makes it easier to follow rapid conversations, especially when multiple people have nicks that start with the same letter or are the same length

is there anyway to display redirects in child iframe, in parent?

Oh, OK.
Is this what you had in mind?
There's all kinds of things I could do with this, if you wanted….

does anyone know why IE6 doesn't read the rowspan property of a TD dom object?
and how to work around it?

does anyone know of a workaround for the javascript sort function in ie7?

"cappytoi" at 71.6.194.243 pasted "json code error" (17 lines) at http://erxz.com/pb/3501

ohreally, wont work same error…

what was the error agian?
geting the height thingy?

http://201.100.2.252:8080/extension/extension.php
window.location.href = "extension.php?tipo=" + document.getElementById('RbDepNom').value + "&valor="+ document.getElementById('TxtCadena').value;
these line not call the same page with the parameters
http://rafb.net/p/6Vwhzn26.html

does anyone could see any error in json code that i pasted into http://erxz.com/pb/3501

i would say first do a alert of what the concatinated string looks like
window.location.href is how you redirect so that's fine
its working printing and seeng the what the redirection is like
s/working/worth

http://rafb.net/p/VPYKaj35.html
the alert line wont display the message, then i think line 9 osubmit not working

what?
lol
do you use firebug?
that's a firefox extension, its amazing
or use aptana ide

sorry for my english
i use macromedia and IE

ok try firefox, install firebug on it, its great for debugging javascript
IE is scary man!!

ok
wich better firefox or aptana ?
for you

i use aptana when i do html files
firefox is good when you building php stuff as in aptana you cant see compiled code

ok

How would one go about creating a popup window then adding data to different element's with specific ids in them? var w = window.open(…); w.document.getElementById(..); w.appendChild(…) ?

hi leute
hi guys
i have a problem
i'm changing the website source with node.innerHTML
but then the dom isn't updated for other functions
so this functions don't run ok
so how can i update the dom?
so that functions changing form elements using dom for it (not innerHTML) can access the new source?

use createTextNode and then append it to the object
using innerHTML is quite risky as you never know what is supported
does that help?

w8 i must look for createtextnode
ok

?
is that a question or a statement?

you mean i should create my design with createElements?
and appendnode?

lol

i mean

if you know what you are dong and that too not at runtime why do you need to build it via dom

is there anyway to display redirects from child iframe, in parent?

unless your html hosting is one js file hahah!!
that will be crazy
document.parent.window.location.href
or something like that

ohreally installed firebug

the user can open as much formular elements as he want
and this elements must be in dom
and i would like to add it with innerHTML
cause its simpler
cause the code of the formular is dynamic
given from an server
and i only add it
replacing some ids in the string
but then i have to request it into the dom
for some functions
how is this possible?

yea everything is possible
document.createElement is your friend

ohreally my problem is an action not?

hmm

action="" ?

but then i have to parse the getted code
cause i have the code

nope

how then?
how can i add all this ellements
i don't know them
they are dynamic from the server
i get the code to add into an div as a string
how can i add this string

newli = document.createElement('li'); newli.value = "asd"; root.appendChild(newli);

with createElement, when every chield in this string must be registered in the dom?

actuly its not root.append its document.getElementById('list').appendChild(newli);

and i have to delete the elements too
how can i make this 2 things?

nm, i should have used innerHTML not value

hello, I am reading data from a stream, using php, and I need to write that data into a textarea
the problem is, the data is written just when the stream is closed
is there a way to write it at the moment I read it
?

not that anyone really cares
excellent!! cheers Jan-

:-)

wrong channel
lmao

ok, thanks

i want to escape this character which is originally single quote ' http://img240.imageshack.us/img240/5953/escapeef1.jpg

ohreally not found my problem….
any advice?

\
\'

http://rafb.net/p/6Vwhzn26.html
can you check
the onsubmit line56 not work, never call consultar function any advice?

does prototype provide a standard interface for setting form values?
for instance, checking a checkbox

never called ?

yes

document.getElementById("RbDepNom") has no properties

the alert not display

if you have a form with an input name="somename" if you pass the value of somename into a javascript as a var can you access document.forms[0].varname.value?

yes, no?

document.form1.RbDepNom.value - instead this, use document.forms['form1'].elements['RbDepNom'].value
and it fails because there is no element with id "RbDepNom"

thast the same for me too right

I want to include a remote js file in a greasemonkey script, what's the best way to do this?

yes, to you too

how can i destory a element based on id?

thanks yup

yup. testing

there is form control, named as "RbDepNom"

var el = document.getElementById("someId"); el.parentNode.removeChild(el);

yup yes check please the lines 59 and 63
input name="RbDepNom" type="radio" value="D" /
and other with input name="RbDepNom" type="radio" value="N" /
is si so/ is so so

to an onClick="dothis('yeah','blah')" and your function is like dothis(id1, id2){ you would access it by document.forms['formname'].elements[id2].value correct?

how can i get the last character of a string

yes
use this - window.location = "extension.php?tipo=" + document.forms['form1'].elements['RbDepNom'].value + "&valor="+ document.forms['form1'].elements['TxtCadena'].value;

ok

(encodeURIComponent(value) available? I don't know if that's prototype-specific or not)

var s = "abc"; s.charAt(s.length - 1);

c

function makeValidRequest(url,divid,newid) { var httpRequest; if(document.forms['form1'].elements[newid].value == ""){ .. still is giving me document.forms.form1.elements[newid] has no properties

"abc".split("//");

{ 0: abc}

it has to be the element's name, not its id

ohh
"abc".split("/./");

{ 0: abc}

im passing the element name with onClick="makeValidRequest('update.php?id=06405&qty=','Layer17',06405)"
DOHH no '
nope still doesnt work
newid should = the element name

paste your code

http://rafb.net/p/uDFYmX59.html and at adressbar i continue seeing: http://localhost/extension/extension.php not: extension.php?tipo=undefined&valor=contabilidad
any advice? yup?

"emence" at 71.6.194.243 pasted "error" (44 lines) at http://erxz.com/pb/3504

there it is
does that make sense at all?

nodes = document.forms['form1'].elements['RbDepNom'];
for (i=0; i nodes.length; i++) {
alert(nodes[i].checked);
}
name can not consist only from numbers

ok

now you can check if element is selected (checked)

so i need to put a letter in front of it somehwere

yes
name="_06405"

YUP THANKS
TESTING YOUR CODE, MUCH THANKS

works ?

i put a Z infront of it Z06405 and still get the no properties error

yup sorry for the caps

but if you want pass value of radio to server hosting you do not need to form url manually
it will be transmitted automaticaly when you submit form
at what line it fails ?

if(document.forms['form1'].elements[newid].value == ""){
document.forms['form1'].elements[newid] has no properties

have you changed name in both form element ant function call ?
img

yes sir

emence why dont you just give the input an id with the same value as the name or use document.getElementsByName('NR0001')[0]

because its dynaic data thats coming out of the database.
I cant hard code any of it

how do i make a var false and then test it? array[key] = false and = 0 doesnt seam to work then i test it in a for ( x in array) if (x)

document.getElementsByName(newid)[0]?

trying that now

please, alert(newid)

alert newid comes up right

what text ?

alert(document.getElementsByName(newid)[0]);
comes up as htmlinput something
the alert(newid) comes up as z06405

and what is the name of control ?

try alert(document.getElementsByName(newid)[0].value); ..

SWEEEEEEEEET
document.getElementsByName(newid)[0].value works like a charm

does your form have nane="form1"?

yup

and what is element name?
z06405 or Z06405
no .. sorry

Z06405 i hit the small z when i typed into IRC
it alerts the same way too

setTimeout doesn't appear to work correctly when the cursor is being moved, is this expected behaviour?

script type="te" (18 lines) at http://erxz.com/pb/3505

that works for me

gregorycu maybe if your pc is really slow? it should not have a influence on it afaik

thats uncanningly weird as heck.. seems to not work that way… lemme quadruplecheck my code

hello people! goodz evenin'
somebody could give a hand, plz?

just ask Flannel
FlashWolf

how can i control elements by its classes?

oops autocomplete rules ;p

xD

FlashWolf there are javascript frameworks which have a getElementsByTagName function
ehm i mean ClassName or Class

i wanna create a function called 'addRoundedCorners()'

this is a good light js library with getbyclasname http://www.robertnyman.com/2006/11/07/ej-the-only-javascript-library-youll-ever-need/

so, when i add a class called ’roundedCorners' to an element, it'll appear with rounded corners
i'll take a look, johnnyisleet, thx!

who has something better than selenium for ajax testing

happy_broccoli http://en.wikipedia.org/wiki/Ajax_framework

what kind of problems are you having with Selenium?

my team wants to see alternatives before going in any direction

do the alternatives have to work with many browsers?

someone can explain me what this thing and how i can read it?==http://saint-tomy.miniville.fr

hey everybody, I'm trying to get this function to detect what image is showing so that it doesn't run the animation on an image that's already shown. I do this by comparing the src of the image that is being shown to the href of the anchor that fired the event. the only problem is that the what
i use docgetbyid(img) and alert img.src, it shows the absolute path, where as the anchor shows the relative path. Any ideas? than
ks.
http://johngiannakos.com/WEB3/WEB3/work/index.html here's a link with two alerts showing the src's, just click a number on the right.
did that make any sense?

http://js.pastey.net/70563 returns 5, when i want it should return 4..

what is track ?
object ?

var track=new Array()

track[x] != false
x - index

start) { can i just do if (() && ()) {

yes
even without inner ()

whats faster 3ghz one core cpu or 1.8ghz dual core… would the 3ghz be faster for one process but the 1.8 dual be faster if I were running 5 simulataneously?

wymetyme!!!
hello

I'm not an expert, but I'd have to go with th 3ghz… it's got more raw power
there's no getting past the fact that they're both 1.8ghz

hey people
how can i make a function instanciable?

just call it with "new"

just this?!
didnt works…
i'm using local vaiables only

so… don't do that then

and so far i didnt got it works…

pastebin some code
http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Operatorspecial_Operators:new_Operator

but i have to do…
i'm buildin my own js lib
fo my website
*fo
*for
www.impactoweb.info
the site is being updated
*there are some bugs*

isin, are the same guy from the php channel?
insin

unless someone has distorted the spacetime fabric to get the same username as me while I'm logged on… yes

uhahuahua

if I have function Test(){ ….alert(this instanceof Test)} and did new Test(); why it retuns false? shouldnt this be of type Test ?

aff

function Test() { this.test = this.constructor == Test; }; var t = new Test(); t.test;

yes I tried that myself and it returned true. but I didn't get why

bah, where's the bot gone
"parp"

freenode–

please would you mind explaining to me why ?

is there a place that i can see a example of how to have objects freely dragable? i want a butn of text boxes that can be draged around the window and snap together? i know its going to be realy complicated but id like to atlest attempt it

google home page?

id rather have something where you could put the boxes anywhere..

any of the dozens of js "web 2.0" libraries out there will have a DnD example

with stuff

so when you say example, you mean something you can cut-and-paste from? or an example to learn from? either way i'd just go to one of the libraries and check their example
i like YUI the best, but there's lots

lol this one is cool, but id like them to be able to snap verticly… http://www.walterzorn.com/dragdrop/dragdrop_e.htm
thanks, i look at YUI

I created an svg rect and wrote some code to move it in the mouse.. however there is some area in the rect that doesn't get the mousedown event.. any idea why?

true
parp

index.php#bar

HI .. Is there a way to seed the random number generator in Javascript? I would like to generate a list of random(ish) numbers but have the list remain the same each time

hey everyone

Well .. the same, depending on the seed that I give the generator

hey, Dr. MONO`

If not, maybe someone could suggest a simple routine for generating random numbers?

why do you call me dr.? lol

Yeah, hold.
http://phrogz.net/JS/Math.randomMax.js

Thanks Bradley, but that's not quite what I had in mind. What I'm looking for is a means to re-seed the random number generator such that after each call to (say) Math.seedRandom(n) the random number generator will produce an identical list of random numbers

is there a way for javascript to determine when a user changes between #hash links on a page? eg: index.php#foo index.php#bar … the page doesn't get reloaded .. just scrolls around to the different anchors.

Alternatively, I could use my own math routine (such a a Reimann-Zeta function) to generate pseudo random numbers
I'm not overly concerned with the range of the random numbers

Hm. In that case, I don't know.
Sorry Carleton.

OK, so the VLC activeX doesn't work in the slightest.
Next pointless task.

Carleton, if you are after long lists of identical but random numbers you could pre-generate all these lists and store them as javascript arrays. then you could load the javascript file containing the array of random numbers every time.

You must add $02 at the beginning of the code and $03 at the end - eg turn on = "$02,'PON',$03".
….about an RS232 stream, what do they mean by $02 and $03?
Literal strings, character numbers, what?

Jan-: try and see?

Can't.

that needs more context

OK.
The situation is that it's a fairly upmarket, industrial-grade Panasonic video projector.
I have raw access to the serial port with my script, and I can send characters to it

heh

It supports commands like PON, POFF, LAMPBRT, INPUT, etc
all fairly basic stuff.
far from rocket science
But I'm not sure what they mean by what they said there.

in that case I would go with the characters

his syntax is odd
"$02,'PON',$03".
what is that, C?

hi guys
i'm making an ajax desktop environment
and i'm wondering how i can be notified that the browser has downloaded all the images specified in the document?
i want to hide those elements until the images have been downloaded, and display a "Please Wait" or similar until its done
hello?

hello

so, my question…

Oh, right
*reads*
You could use script's DEFER attribute
Something like script type="text/javascript" defer="true"removePleaseWaitModal();/script

logankoester, if an element's visibility is set to hidden, does the browser still download the content, but just doesn't display it?

that's correct

or does it wait until the element is set to visible

there is onLoad emthod

It will download it and not display it

okay

is there any zlib tools for uncompressing a string in javascript?
(and compressing)

hi everyone

Hello! do you know the solution for the onblur="window.close()" on Internet Explorer? I want to close a pop-up window when the user click anywhere outside it but the behavior within IE is buggy

try not using a window
make your own window

yeah, but for now I can't

alpha(opacity=#); and then kill the element
why not?

http://tipling.dyndns.info:3030/ ?
:/

s|k, i like it … thou it hang a bit my ff … but maybe its because of firebug and many other tools

I need a loading dialog up front
or something

I have a gallery, I want to make it so that when you click the image that's already being shown, it doesn't re-load it. if I get the src of the current image, it gives me an absolute path, and when I get the src of the image that's been chosen to display, it's a relative path. any ideas on how I
can prevent the same image from re-loading? link: http://johngiannakos.com/WEB3/WEB3/work/index.html

hey guys if there's some javascript which is writing about 5 lines of text to a page I have, is there a way to prepend something to each line, such as a » ?
I doubt I can use CSS for that right

save the loaded image host in an array
check the array before loading images
the image name

anyone?

or soemthing
use the concatenate operator?
concatonate
sp
+

is there a way for me to get the relative path, I'd prefer not to use some kind of global declaration of the previous image being displayed

oh, no I mean the script is from an outside source which I have no access to (digg.com), it's writing about 5 lines to my page which I'm embeding it in, but I want to prepend each line with something such as », anyone have any idea?
guess not

hrm
I'd have to see the script
split the src string via "/" and then remove the base?
I don't know if there is anything prebuilt into javascript that does that
dojo does have something like that

var thing = document.createTextNode('»'); document.[diggID].appendChild(thing)
coudn't you use that?

http://digg.com/tools/diggjs/user/dugg/jorgepblank/9
that's the script

assuming you can the dig thing has some kind of id

(view source of course)

what do you want to right it before

yes sir, prepend it
so it writes 5 lines to my page, I went each line to have a » in front
or something, even a -

alguien habla español aqui?
o entiende?

maybe you can request that script via server side and then modify it
and then put in on your site
that's a generated script obviously

Thanks s|k and johnnyisleet, I was just wondering if there was a simple way to do it, else I don't really mind, thanks anyways guys.

no abla
habla*

I don't think it'd be that hard
but w/e

what do you suggest I do

my first instict would be to wrap it in a div, get it's ID, loops through all the containing div's that Digg createst, and then create a textnode with whatever you want, and append it before each div
but maybe others disagree?

how do I make these div's aligh http://202.10.86.59

yup
nah that's a good js way to do it
I think it would be easier to just do it server side :P

thanks
yeah I have a server-side script that does it

no prob, good luck

but it's not as instant
that script tells what stories i just dugg, and the server-side way isn't instant while the pure js way is

oh right

alguien sabe de algun canal javascript en español?

hey s|k my url has more then one '/'

is that really complicated? I have little js knowledge, though I do program in other languages, I just wouldn't know how to 'loop through all containing divs', etc.
but I guess I can figure it out

but you know how many right?

It's not too hard. wrap it in a div, use doc.getbyid(), one you get it's reference, go [reference].getElementsByTagName('div');

thanks

getelementsbytagname will store the divs in array syntax

that was odd..

sorry but wrap 'what' in a div?

the whole digg include

?

whatever code dig dumps into your page
where can I download this script your using.

alright
I'm supposed to embed this in the page, script language="JavaScript" src="http://digg.com/tools/diggjs/user/dugg/jorgepblank/1" type="text/javascript"/script
what's what dumps the lines
so the script is in http://digg.com/tools/diggjs/user/dugg/jorgepblank/1

riight. aright i'm gunna play a bit.

thanks I appreciate it
hold on, its
script language="JavaScript" src="http://digg.com/tools/diggjs/user/dugg/jorgepblank/9" type="text/javascript"/script
so the script's at http://digg.com/tools/diggjs/user/dugg/jorgepblank/9
my bad

hi everyone

thanks johnnyisleet, I appreciate any help you can give (as well as the one you've already provided)

I was wondering, Can I change elements properties with java before the page loads.. ?

with _Java"_ ?
/topic

I mean javascript

say 'javascript' next time :p
or 'js'
or just omit the name, and we'll assume
what do you mean before the page loads?
to what end?

blanky:it's annoying cuz it's just throws it in there.

don't worry about that man, it's alright
thanks anyways I appreciate it
later, johnnyisleet

reisio, well.. I have a page that have full sized images in one page, I want them to be thumbed automatically, this I have fixed.. but I need somehow to insert the image name in my xhtml code..
not sure how this could be done!

you want them to be replaced with thumbnail versions automatically, or just have their dimensions set very small?
the name?

hi, i'm using prototype and want to update innerHTML on a select object, but ran in to the IE bug making this a pain. i have worked around it in one place using outerHTML, but in another (complex, dynamically generated, array-of…) select, i have onchange handlers and can't let them die. how
hard is it to programatically attach an onchange() to an entire form? i tried this with HTML before but reached the conclusion i

replaced with my thumbnails that I create with a php script that i call on using ajax

i'm still workin on it, just for fun

alright, I'm going to go do something but I'll be back, if I'm not around when you msg me I'm logging the conversation so I'll message you back, if you have to leave or you couldn't figure it out, don't worry, I appreciate it anyways

haha aright later.

ah
well you could get their container with getElementById, then use getElementsByTagName to swap them out
but why not just use the thumbs by defualt?
default*

so getting their containers is the correct way of doing a task like this? Im new to js!

it's one way
doesn't seem like that bad of a way to me, but others might know spiffier ones

anyone use adobe apollo?

however, I think you should probably just use the thumbs by default
whasat?

I mean adobe air?

Yeah, feels like using the name by default seems the way to go..

whasat?
not the name
use the thumbnail images by default

considering I know what names the thumbs will get so that saves me alot of work

why replace the larger images with thumbs? :p

hmm, don't know actually, didn't give it that much tought more than I needed to make them small and load fast

so just use the thumbs by default :p
no need to swap them…

http://labs.adobe.com/technologies/air/

ok

horrible name for a software :p

tell that to adobe

I would if I cared about them

but the software itself is pretty cool

oh right I remember this

so that implies because you told it to me that you must care about me…. *blushes* :-*

well, it doesn't exactly imply the opposite, at any rate

Is there any cool script putting borders on images and stuff?

img { border: 5px solid fuchsia; }
:p

maybe not the best border color .. lol

:p

missing ) after argument listSource File: http://www.gigdates.com/venue.php?id=6967Line: 65, Column: 47Source Code: map.setCenter(new GLatLng(41.878249, -071.369899), 15);
what is the deal?
it is pointing to the right of the period next to -071.369899
map.setCenter(new GLatLng(41.878249, -071.369899), 15);

how to make a big cover before everything is loaded?
the problem is where i should put that cover function
..onload seems to be late

onload is run once everything is loaded

hmmm ok

you can put a script in the head part

you know this might help me too


but before body is loaded, no element can be display
displayed

is loaded?

hide
put everything in a div, and hide that div

gregorycu cool ! thanks body to be hiden

… /div

If you can do it to body, that would be better

ya, couldn't think od this method
btw, one more thing. how to auto resize images?

to what size?

an image seems to have no width, height befor it's loaded
to be within screen deltab
i've used a stupid method. i hide the image before it's onloaded
then i got height/width to resize it to be wthin screen and show it then
but is it possible to resize it before it's fully loaded?

set a width or height attribute or style property

deltab but i don't know the width/height of the image in advance

I thought you wanted to override the image's own size

img_ref.offsetHeight seems to work only after it's loaded
delta yes i want to override it in ratio

I'm back

set only one of the width and height, and the other is calculated by the browser

how do you link with javascript?

if the image is smaller than the screen…?
i don't need to resize it to fit screen
corevette script

link what?

what's wrong with a regular link?

script type="text/javascript", please

like if i want to do the action swapFade()

onclick = xxx();

a onClick='swapFade()'click here/a
?

can you store the image size in a database?

onclick=xxx; NOT onclick=xxx();
(unless you're talking html, in which case it's onclick="xxx()")

Woosta ya,,,he is talking about linkinf with html
*linking

So don't give him BS code :-D

heeh

deltab no..it's a file from filesystem
Woosta BS?
== bullshit?

`abbr bs

Bull Shit. What ever you said: it's bullshit. We don't believe you

heh

a href="#" onclick="swapfade();return false"CLICK ME WILD MAN/a

Grrrrr
`best practice

is auto resize of images a difficult task???

`js best

`js auto resize

`no @ DavidHKMrPowers

no: Don't make shit up.

learn best practice a href = a href="you_need_javascript.htm" onclick="doWhatever(); return false"

OK

what does return false do

(not href="#")

OK

it returns false

stops the href being actioned

so what would happen if i didn't hav eit

It will follow the href

hopefully to a page with as equivalent functionality as possible, rather than just saying "you need javascript"

(not href="#")

OK

the function is called and then the href is redirected
without false
without 'return false;'
i want to show an image within screen, how?

I did it.

really?!

haha yeah
hold on
i'll pastebin it

O'REALLY?!

.offsetHeight has no value until the image is loaded
so, i can't make it resized before it's loaded
any ideas please?

* display:none?

johnnyisleet me?

or, * visibility:hidden; get the offset, then change the visibility

get the size server-side and insert it into the script

sweet, thanks man!

yea, sounds pretty sketchy

johnnyisleet i'm using this method…but it's not good..

oh ok, srry didn't read up

johnnyisleet clients cannot view the image loading
deltab from server side!?

where can I post code.
paste

hold on

where the image is

http://paste.jorgepena.be ?

there she is
http://paste.jorgepena.be/5417

deltab it can be passed through server side but any easier method?
from filesystem

thanks johnnyisleet ! I'll figure out how to use it now
very much appreciated johnnyisleet

not that I know of

WTF are u guys talkin about

deltab thanks

find image size; send image size in HTML, CSS or JS

i'm on msn at johnnyisleet@hotmail.com
i'll explain you some of the code.

thanks
I added you, you didn't get any notification?

is blanky a girl?
johnnyisleet talk here otherwise
:P

huh
Is any good javascript IDE u guys can recommand?
Using notepad to code Javascript is obivously not good choice

you can try 'aptana'
which is really just a plugin to Eclipse, which is a Java" app
I have heard good things
really, though, you should only need an editor with decent syntax hilighting

heheh

with intelli-hint will be better

take it to twitter

what platform are you on?

U dont have to nmemories those member function anyway
I work on windows

right
then aptana
www.aptana.com

Am I have to download eclipse

..no

Thats software seems like huge

just get the .zip version of aptana, all you do is unzip, done, run the executable
yes, 50mbs

the best way to return false using a function is onclick = return whatever(); at the end of the function write return false;

are you on broadband?

*usually.

Sometimes eclipse will just crash on my mechine

..

Huh,yea

big difference, aptana .zip is just 45mbs I think, full latest Eclipse is 125mbs
aptana uses Eclipse libs
but is all in the .zip

Thats almost one-third of eclipse
Its very nice of u to tell me this
I think visual studio 2005 also works quite well

as well as Microsoft bunk works :p
`js ide

IDEs for use with Javascript: Try `js ide windows, or `js ide linux

`js ide windows
`js ide linux
`js ide windows

http://www.aptana.tv/movies/aptana_outliner/Outliner.html

okay then :p

or ChandlerBing http://www.aptana.tv/movies/aptana_overview/Overview.html

y'know what else is handy is firebug in firefox (or other browsers with firebug lite)

is rather a big package, but covers a lot of ground comparatively to most
`js debug

Try `js firebug, `js venkman, `ie debug

howdy. I can't seem to remember how to modify text within a table cell dynamically using javascript properly. Is the innerHTML the thing we should avoid, or use?

jnguy[w]: in this case, depends , why are you editing it for?

so basically I have a table filled with preferences.. Each row has a 'priority', but if you delete one, all the priorities below it should be minus 1… any ideas?
Thanks in advance.
I think I remember people saying that innerHTML is a necessary evil. Am I correct?

the aptana log is a sprocket?
that's one crap logo :p

nodevalue perhaps.

heheh

wow this guy types horribly :p

http://www.aptana.tv/ the whole bunch of flash videos :P
heheh

heh
do you know what engines Aptana can/does use for preview?

nevermind, nodevalue was not it.

How to code muti-browser website

these are nice - I'd never actually looked at Aptana in-depth
but now it looks like I can add it to my list of editors to suggest to newbies
the ones that ask for preview-ready ones
and code completion, too
and compatibility
(browser)

Asp.net AJAX

moo, he typed script

Seems like muti-broser stuff

ohh
hehe

wow he had to retype 'Sue' three times :p

primarily uses Firefox or Mozilla, either but preferably Firefox
when editing a html file, it gives a [preview] tab next to the [source]

anyone have an idea?

they also have a firebug patched, with joe hewitt permission and all, to integrate it with their IDE
the feature I use the most, is the OUTPUT window, since it objectifies in a tree-like parent-children objects, and you can jump back and forth with one click

he uses a strange indent style

reisio, so how can i do that in javascript?

I really wouldn't know where to start

innerHTML works. Thanks guys.

I know what I'd search for
'javascript image mask' or the like

ok

ask the channel, though

jnguy[w]: so, you're rewriting the values for all row cells on a change?

row cells? just a single cell in a row that has a higher 'priority' than the one deleted.


what are you trying to do?

i need to generate a mask of an image

jnguy[w]: I see, if you're not affecting the Table elements with DOM methods, use innerHTML, else use DOM to change their .nodeValue
define 'mask' :|

the part of the image that is opaque

?
images aren't opaque?

i need to generate a second image that has the same opacity mask
CommandPrompt, they can have transparent parts too
specially icons

so i want to generate a second image that has the same opacity mask, but a single color

why you need to be picking on pixels btw?

because i'm making an ajax desktop environment
and it has icons on the desktop
i need the icons to be highlighted blue when they are selected
so what i plan to do is:

suspense /

div(background is the mask) { img(icon pic) }
and i can toggle the opacity of the img element between 100% and 50%
to simulate highlighting

Thanks.
Is there a list of DOM methods?

right now, i have the entire background as a single blue color

jnguy[w]: yes

so that when you select the icon, a blue square appears
instead of just being blue where the icon image is opaque

err. Sorry if I sound like an idiot… but I don't really know javascript, just dabbling really.

are you sure js can't do the opacity setting on the image? without having to have a 2nd copy?

binding objects to functions… is this possible in javascript?
and, if not, what is a nice work around

CommandPrompt, it can, i'm already doing that

;google +dom2 +methods site:zvon.org @ jnguy[w]

jnguy[w]: http://www.zvon.org/xxl/DOM2reference/Output/Core/_methodIndex.html

the opacity mask is for the background that shows through once the img's opacity has been set to 50%

Thanks.

doeable, what do you have in mind?
not sure I follow you on how the 2nd image copy, comes in place :|

ok look
i have a div element
i've set the background of the div to a shade of blue
than i have an img element inside the div
the img element displays the icon file
and it covers the entire div

\n is NOT punctuation

now if the icon file is square
Woosta i know, i press enter where i would pause if i were talking
when it finishes a coherent thought

That's what a comma or a period is for

anyways…

It's damned annoying

CommandPrompt, so if the icon file is square, the background of the div does not show through

hehehe

CommandPrompt, because its completely covered by the img element

not very concise ^_^

coherence … I'm yet…. to get :|
I know it involves an image and a div :| … and some color scheme
so

divimg/div
thats the structure

a div wrapping a image, which provides a border around it too :|
so far all css and markup

the div has no border, no margin, no padding. just background color

so is just a wrapper, sooooooooo

the div has width = 32px, height = 32px. the img has width = 32px, height = 32px

how does the 2nd copy of the image help?

you'll see that for yourself once i describe the problem
imagine for now, that the img has a square image file loaded into it
its gonna be displayed as a 32×32 image in the browser right?
in its original color
correct?

seems to me you just want a …. grayed-shadow-like copy to be used when draggging and dropping


am i right, or am i wrong?

…. heehehe

can u answer the question please

is THAT what you're after?
seems to me you just want a …. grayed-shadow-like copy to be used when draggging and dropping

no no
i'm helping you to understand the problem right now

LOL

heheh
I'm back to square one, a Div with a 32×32 image

let me start over

Oh goody

div style="width: 32px; height: 32px; background: blue;"img src="icon.gif" width="32" height="32"/div
icon.gif is a 32×32 square image

I got that much

so what will be displayed?

hee
the image ^_^

yes
now if in my javascript code somewhere
the_img_element.style.opacity="0.5";

STOP USING \n EVERYWHERE. NOW.

NoorulIslaam.replace(/\n/g, ' ');

what happens to the displayed image?

nothing

hehe, how does the 2nd copy of the image plays any role on helping for any effect in a practical efficient way though?

in FF 1.5: nothing
what second copy of the image?

Woosta, assume we're running in a CSS3 compliant browser

LOL

CommandPrompt, i haven't mentioned any second image yet

hheh

You're expect to see a half-faded-to-blue image

Woosta, yes
CommandPrompt, do you understand that?

Woohoo!
What do I win?

he's writing a distribution of kinds, desktop something, now, he has the images icon.gif needed, the gifs are gif89, with transparency indexed images, he wants to on-the-fly make a 2nd copy of the image-ONLY-OPAQUE-pixels, leaving out the transparent or something like that

whuh?

so, in short, on-the-fly snapshot the .gif BUT only certain specific pixels from it, and not others

not going to happen

tis what I'm thinking

did you guys get my explanation so far?

but I think what you want, a cSS property or something else will do the work, and you don't need the extra overhead of a duplicate image copy

can we imagine for a moment

div style …. — that that was the first line i said?

and forget everything before that please?

I got the div and a 32×32 image

I got a whole shitload of newlines

the_img_element.style.opacity="0.5"; — did you understand this part as well?
Woosta, you got a problem you can put me on /ignore

Nah, I don't tend to /ignore people that annoy
I'm more one of those arsehole ops

I got the opacity part, but you're yet to show your 2nd image copy usefulness

CommandPrompt, okay
basically what my javascript code does is when the icon is not selected, it sets the_img_element.style.opacity = "1.0";
and to 0.5 when it is selected
forget about the 2nd image
that was just something suggested to me by reisio

Voluntary kick :-D

how do you get the height of a div, i tried to use document.getElementById('panel-draw-content').height but it came back as undefined

document.getElementById('panel-draw-content').style.height

offsetHeight
style.height will only have a value if you set a value

.. yeah.. :|

ok that worked a treat, thanks

hey guys

http://pastebin.ca/611984 . See if you can help.

The paste 611984 has been copied to http://erxz.com/pb/3506

I have some functions in an external javascript file I created, but how do I use them in an XHTML file?
I already did script language="JavaScript" src="digg.js" type="text/javascript"/script

it says it's undefined

in head?

oh, no, I'll put it there then thanks

yeah

tag in it (It takes it from another PHP file, etc.) so I just added one in myself, then called the function later on

tag in some other files then

no, still no dice

tag and then later on just did

make sure is below the .js inclusion code/tag

and it's still undefined

sorry?

fin…
ohhh
window.onload = findDigg;
no () from that scope

hehe

Comments

« Previous entries · Next entries »