Archive for Uncategorized

if I dont move the declaration of the time variable to firstCalled then it wont get reset and the timer will stop

shouldn't the function on line 9 match the one called in line 7?

Oh yes, thats a typo. Correct.

\o/

i look for some simple rtf editor (just need bold/underline buttons)
any idea?
iframe based prefered.

Search for free WYSIWYG editors.

Yahoo recently added a rich text editor to YUI. Might be worth a look: http://developer.yahoo.com/yui/editor/

http://www.themaninblue.com/experiment/widgEditor/

if I don't move the declaration of the time variable to firstCalled(), then it wont get reset and the timer will stop after it hits 0, right?

Wait. I will paste a simple snippet.

Sorry about this :s
oh wait
I think I got it

Heh

keep the declaration out of the functions, set it back to $seconds when it reaches 0

Yes, thats what I was saying.
That way it will keep on ticking.

any idea why this wont work? $(strDivIDCloser).onclick = function() { alert("Closed!"); }
where $ is that generic prototype function

Pixotic- : http://pastebin.com/m605ae98b

o_O
that looks a lot more complex than what I started with xD

I thought you needed a working solution… ;–)

Oh, believe me I do
and thanks again
I'm sure this kind of stuff isnormally way below you, I appreciate it

I hope it works for you.

well the file on its own sure does
now to try and transplant it
one question
why the CONST var?
why not just declare time to be 6

Thats good programming practice.

feels woefully ignorant

You will notice I use the value 6 at two different locations.

I'm self taught mostly, so a lot of the etiquette is missing

If I need to change 6 to 60, I will have to make changes at two locations.
Imagine this for a large program.
More changes = more bugs

Ah, that makes sense

Good.

how can i make any div onclick do somethng just with js?
is div.onclick=alert("test!");

hello. does anyone know where I could check the syntax of a javascript document, where I could find errors in the same way as I would by compiling source code…

firefox with firebug extension

document.getElementById("divId").onclick = function { alert("hello"); };

yes I use that already but it doesn't give errors as compile time, it gives errors at runtime only when a specific function is called etc etc
I'm looking for static debugging capability

Javascript is a weak and dynamically typed interpreted language. You won't find the kind of capability you are looking for AFAIK.

it's working perfectly, thank you!
http://madl33t.net/orion/timecode.php?time=5

Pixotic- : You are welcome. Enjoy

thanls
what is the other way of holding data in javascript tan arrays?
i forgot the name ……

Hashmaps
Almost everything is Javascript is a hashmap i.e. having key value pairs.

but it ws a way to hold data that was great for ajax, hmm what was it called ….

JSON ? XML ?

e319, JSON
ah no
you're asking for a way of storing data?
Objects.

Comments

I had a debian system a while back running apache 13 and php 4 For some reason it didnt require a php at the

getSingleton();?

NemesisD, you should really look at php.net/language.oop5.basic
and _read_ it.

and read it.

you have to realize the practicality of doing that though, i'm still learning OOP and i'm up for making my way through that, but that's asking me to spend my entire evening reading a section of the PHP site before I can fix this problem

NemesisD, um would you rather do it completely wrong?

NemesisD, you can't assign default values of class properties with dynamic expressions. It's explained there.

hello

You should read at least the basic info. And you need to declare $registry outside of member methods with 'var $registry;', and then reference it with '$this-registry' elsewhere.

a singleton - class

assuming PHP4, as declaring visibility is prefered in PHP5.

Indeed
Even though you are using __construct

ok so construct does count as a member method?

Yes

ok

throughout the class

NemesisD, don't cut corners

Without using $this-, though, you are just creating a local variable within each method

I have a class, and I'm setting up some permissions as constants. I'm using a bitwise setup to check permissions. However, I can't seem to set one constant as a shifted version of the previous ie: const MATCH_DELIVERY = self

Comments

I have a site that uses GD debian server etch I apt-get install php4-gd and now when visiting the site I get -usr-sbin-apache2

connect('mysql'); $db-getAll($query); and boom you get your array rs back.
:-p

My class is really, really simple

well take mine and play with it

Hahahaha
No thank you. I have no idea what half of this stuff does.

joshteam and Tachyon, get a room you two

hey folks, i can't seem to get EXEC or passthru working… any idea what I can check to make sure its not a server issue?

joshteam "array rs" what is "rs"

joshteam is getLastID method in your class safe?

Recordset

ok

yes. Race conditions don't apply as it's connection independent.

I _just_ started being able to understand OOP; doesn't mean I understand all of its concepts. Prior to this I wasn't able to comprehend OOP no matter how hard I tried.

oh durh, i need the full path to the binary

hi,all

joshteam, i am asking because the mysql_insert_id not always correct

I m new user here,

how do you figure? :-p

hrmm… passthru("ls"); shows me the files. but when i attempt to use passthru("ffmpeg") with a command, it fails.

where have source code of food wetsite with php ?

any ideas?

joshteam, what if the same query excuted by two users at the same time

it's connection independent
so they would return the last inserted id via that connection
http://dev.mysql.com/doc/refman/4.1/en/getting-unique-id.html
you can read about it there
read the 2nd paragraph that starts with, "For LAST_INSERT_ID(), the most recently generated ID is maintained in the server on a per-connection basis. "

ok i've always avoided using it joshteam thanx

nope, it's safe.

anyone think they can help? cant seem to get exec() working with ffmpeg

is that… english?

CHINESE ENGLISH!

is wetsite some keyword for porn?

// there ya go

Anyone here use a php debugger?

like.. the browser?

nope
I was thinking about either xdebug or phpdbg

what would the point be?

its been a little while, but I have used kdebug
xdebug
i mean
typo
lol

why would you need such a thing?

Well joshteam to find out what are the errors in your php code. As with any language debugger

some people write php apps more complex than php echo 'h1FOOOOD/h1';echo'This is food'; ?
;-)

lol, you can still execute these complex apps

;(

I wanted to say that kniolet but I have been accused of being rude in here before

shoot. not gonna hurt my feelings.

ah, me is sleepy -.-

Yeah well I now watch what I say

have you ever written a PHP app with more than 2,000 lines of code… at some point you need to be able to see whats happening while its happening

night everyone -.-

but please tell me an instance when you couldn't execute the code to see the outputted errors? or have the errors logged to a file?

its not just about errors

yeah that's why I throw and catch custom exception & store them.

its also about optimization

Its about the flow of the logic also

yep

if u don't known, don't reply pls.

lol, how does a 3rd party debugger help w/ a) optimization & logic flow that you couldn't do yourself?

when the results are not what you want but they do not produce and error message

i don't use a debugger even for c++

TDD is at MOST what you need.

Or better yet tryign to follow the logic flow of someone elses code when he/she has not documented it.

heh, some of the really good C++ toolkits (qt,gtk+) make debuggers less necessary if you stick to using them i think
what OS are you using?

the # of lines of code != the complexity of the code. If you are having a hard time with logic flow check out Finite State Machine Design otherwise just write an exception handler. that stores the exception(s) it catches all the way down to the line & file with it's trace.

debugging and profiling helps a lot, especially when trying to optomize any code… do you know every little nuance of the language and how it reacts with the platform?

GTK+? i love to waste my time, i don't use ide's

as well as finding syntax errors

don't need to. I aim in ##php talking about #php
and a 3rd party debugger for php is … funny.

debugging and profiling are key to writing high quality, highly optimized, high availability code.

especially with php, considering php has such a low barrier of entry, i doubt many developers who use it understand in depth whats going on in the background
especially for profiling

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

lol, whatever. believe what you want; it shows your skill level imo.

Open Office here LOL (I don't have that many to generate)
exactly, not using the tools available shows inexperince IHMO

lol. I don't use Paint.. i use photoshop. I must be inexperienced

how on earth does debugging or not indicate an individuals understanding or experience?

debugging is fine. Using a 3rd party app to debug a non-compiled, intereperted web language is.. ridiculous. Use TDD if you need to.

imho, imho is the most annoying abbreviation

if you use Linux, if I remember correctly, you can output profile info in xdebug that you can view in KCachGrind which is REALLY REALLY helpful
LOL

are you familiar with TDD?

what's wrong with using something like xdebug and kcachegrind ?

normally pcre matches are ordered by how the parenthesized expressions appear in the pattern

yes

i thought I just said it..

tdd is not a replacement for profiling or debugging…

is it possible to get pcre matches ordered by how the parenthesized expressions match the subject?

are you familiar with the ability to extend exceptions and how to get info out of the exception objects?

mutually exclusive practices

LOL yes

then please explain what you gain from these 3rd party apps that a combination of good architecture, mvc, tdd, and exception handling doesn't give you?

so /(?.(\w+)|\[([^]])\])+/ applied to ".foo.bar[a.b][c.d]"

show me how to efficiently optimize 30,000 lines of code using exeptions and I will concede

Hello, i have an array ($file_types = 'blah', 'blah') .. how do i echo all those out as blah,blah blah

matches[1] ordinarily is "bar" and matches[2] "c.d"

so you are saying the only way to "efficently" optimize large code bases is with 3rd party automation tools? :-p

i want to get matches = array("foo", "bar", "a.b", "c.d")

following design patterns isnt a substitute for profiling execution and debugging large applications… you use them in conjunction with one another

alex20 use implode()

no, you must use design patters with development designs and good custom error handling relevant to the business logic.
3rd party tools aren't in that formula.

you do what you do and let us discuss debugging in peace please LOL

fair enough. Just for the record, I've worked for y! and Lending.com + some other shops and if anyone used a 3rd party debugger, we'd laugh them out of the team. :-p
I mean we used high end stress test software and wrote our own work tree process for each app of high scale.

im not going to get into the "ive worked for" thing with you LOL

kniolet, forgive me for asking but why are you capitalizing lol

I'm just laying out that I have -some- credibility. Not a pissing contest.

because its an initialism and thats propper grammer ;-) if it bothers you i will use lower case though teehee

kniolet, yes it does, sorry

why would you use proper grammar in lol, but not with your sentences? :-p
err kniolet not irisblaze
it's late im tired :-p

lol (better irisblaze?) ;-)

much better kiolet thanx :P

are you still here?

you live in htown? :-p

I used to

dallas
i went to aTm

I know this is probably off topic, but does anyone know XPath?
I'm using php to do queries with xpath

whatcha want to konw?

ohhhh that's why we are fighting, I don't like Dallas LOL oops lol I mean

lol

i live in houston heh

Awesome! Houston is hands down my favorite city in the US (except in July I guess, lol)

f00li5h, you here?

you a Cowboys fan?

not really, not big into sports :/

err 2 things i don't like about my profssion
not many co-working woman in the same dpt worth looking at. and not many sports fans.

yeah, a lot of the guys i work with are into sports though

** not saying there aren't attractive woman developers, just haven't met any
developers?

yup

damn
:-p

hey all.

what i would do

where I am working now there are many developers who are very into sports
he george

I guess i've just been jipped

how is dallas, ive been getting job offers like crazy for the dallas area

now tennis, golf doesn't count

but I'll admit I don't care at alla bout sports

market is good right now. I love it, but I am biased. I've lived here 21+ yrs

I worte a simple recursive function to find some data in an object (which is just a bunch of nested objects and arrays) http://pastebin.com/m68eabfc0 , but now I want to modify it to find AND REPLACE, and I have no idea how to go about doing it

they follow literally everything, I don't know how ppl can keep up

any developers here, intrested in designing a new project?

to do what?

I know most stats of the cowboys for the past 10yrs

i feel like it could be a simple change, but i cant think of how for the life of me… any suggestions are much appreciated http://pastebin.com/m68eabfc0

sure, but do you know the stats for golf, football, baseball, soccer, etc and including college and professional leagues

i feel like this should be pretty simple…

you might
but I just can't fathom such commitment

Dallas Cowboys, UT Longhorns, Dallas Mavericks my top 3 i know everything.

hi all
could someone please help me with redirecting a URL either though PHP or .htaccess as I am bogged on 1 thing?

no, i really only "FOLLOW" those 3.

user-admin kinda thing.

when you say design do you mean you'd like to start a OS project or what?
because I'm not actually interested in working for pay or something like that

No, based on Debian.
a simple control panel, which lets you perform several tasks

replace with the same string right?
just pass the replace string as a parameter

anyone?

and when data == needle just say data = replacement
what are you trying to do with the .htaccess?
mod rewrite?

SPFHelper in php use header()

what i mean is this: im recursively traversing the object to find my data, and that part works, but once I do, how do I modify the ORIGINAL data… with a memory pointer you mean?

Hi
http://bin.cakephp.org/view/518276432

php doesn't have pointers

I don't want to flood or spam the channel so I copied it here http://bin.cakephp.org/view/518276432

instead of saying "FOUND" i want to change the value and have it be changed outside of the loop

Comments

I have databes with 120 000 records in the biggest table But my application starts to working slowly after inserting

I get "Can't connect to MySQL server on 'www.zendurl.com' (4)" from $con = mysql_connect("www.zendurl.com:80",$username,$password);
that's not very informative :-(
I'm positive my username and pass are correct
hmmm

but is that for local host or tcp connections

helo

use a semi colon

i upgrated mysql from slack 11 to 12, and my database is gone

ThinkMedical ya… how to use returned results directly for UDPATE?

UPDATE blah WHERE blah; SELECT * FROM blah WHERE blah
unless im wrong (?)

ya…
say, if SELECT returns 100 rows..

use update ffs

ffs?
archivist a little bit more hint please?

your questions are not clear enough to get more hint

ok…

it shows a basic missunderstanding of basic sql such as update

you want to return the updated rows from the query? essentially something like SELECT "UPDATE…"

I need to SELECT * FROM `crawl` WHERE `last_crawl_time` 100; UPDATE (these_resulted_rows) SET `last_crawl_time` = 101;

hehe

sigh

he has no idea
even spoonfeeding him fails

put your select in a WHERE clause on the update, DavidHKMrPowers

UPDATE `crawl` SET `last_crawl_time` = 101 WHERE IN SELECT * FROM `crawl` WHERE `last_crawl_time` 100

no selecat at all

oh
same table… sigh

just a where clause needed

get rid of "WHERE IN SELECT * FROM `crawl` " DavidHKMrPowers

um…so what would be returned resutls?
do i still get the certain rows updated?
phpmyadmin returns nothing for this…

the rows update and you get a boolean result

oh…i can't get only a boolean,..
i needa to get the rows also… since i need to crawl them

the use a semi-colon

why i update them is to udpate them not be crawled in short time

UPDATE `crawl` SET `last_crawl_time` = 101 WHERE `last_crawl_time` 100; SELECT * FROM `crawl` WHERE `last_crawl_time` = 101;

after I change my.cnf (which I found on my own - woot) I assume I have to restart mysql? (since changing my.cnf did not seem to make a difference)? I've looked around for docs on restarting mysql - Im looking for something like graceful — this seems overly complex for just restarting the
database nicely: http://dev.mysql.com/doc/refman/5.0/en/mysql-server.html
?

ThinkMedical ya…it could but still no…because there could be other rows whihch habve `last_Crawl_time` = 101 too
needa update exactly the last selected rows

youll probably need cursors and such

o.O

there's a RETURNING keyword in pl/sql not sure about std. mysql sql

oh…btw…innodb and MyIsam which should i use?
maybe becasue i use the incorrect db type?
i am using myisam

Doesn't matter. Just make sure your search criteria only picks the last 2, using an explicit ordering since rows in a table have no guaranteed order.
Don't select. Just perform the update properly.
By doing this you won't have to worry about any sort of locking.

Xgc ya…but i need to get what i 've updated
i mean i need to get the rows i updated

If you have a specific that isn't behaving well, post it exactly so someone can help you with it.

they have tried

Ultimately, you may need a safe process, if you have requirements beyond just updating the rows. You could even use a trigger and a column that indicates who performed the update. By doing that, you can determine which rows you updated without being bothered by any updates by other users.
The trigger could insert logs into a separate table to indicate which rows were actually updated.

Xgc ya..i also thought of this method…but things would be complicated then…

Actually, that simplifies the process.
This creates a queue instead of requiring locks. You can take your sweet time without worrying about impact on any other users of the table.

you can use cursors in mysql?

You can.

you can use FETCH then i guess, with a cursor

possible to get last_update_id ?
if possible i would update it first and thene select

Via trigger. Otherwise, not directly, without locking.

i let it be..

greetings
Host '192.168.0.31' is not allowed to connect to this MySQL server
any idea?

it means what it says, you need to grant your user rights to log in

i did

GRANT ALL PRIVILEGES ON *.* TO 'oo'@'*' IDENTIFIED BY 'XXX' WITH GRANT OPTION;

Query OK, 0 rows affected (0.01 sec)

can anybody help with this? If I aquire locks using GET_LOCK from within a table trigger, will it stay locked until the trigger runs again and unlocks it? or automatically unlocked when the trigger finishes?

external

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

all the case expect what is "external" ?
woa
% instead of *

aep and check if you have an anon user grabbing the login

found. thank's anyway
havea nice day

hi, i'm trying to sum the last 6 values for a praticular IP in my db… select sum(amount) from accounting where ip=$ip will give me all.. how do i make it limit to 6?

i hv been installed mysql .. at rhel 4 .. how to start its service .??

service mysql start
or service mysqld start

… order by timefield desc limit 6

thx pb

(where "timefield" is some field that identifies the rows chronologically, obviously.)

it returns -bash: serice: command not found

did u miss the v out?

try "service mysqld start"
oh.

can i print somewhere which i get … basically i hve been remove php mysql web hosting .. now i install it again
?

what are you trying to accomplish, exactly?

if service doesn;t work, u can use /etc/init.d/mysqld start

or /etc/rc.d/rc.mysqld start

i hv tried to install mysql .. but getting msg .. there is no mysql.sock .. i could not locate it
so i m installing again ..

that would be an error you get as you start mysqld, not install it.

u logged in as root?

the sock is created by running mysqld

check if u have /etc/my.cnf

read the INSTALL docs for your distro. You need to install the initial database with mysql_install_db

from where .. will u pls guide ?

that depends on your distro.

using rhel4 … will u pls check, this link http://sial.org/pbot/26565

read paragraph 2, please
but before you can do that, you need to start mysqld
I would recommend asking in #redhat or #fedora to inquire on the exact startup script location.

ok

cluster works with MySQL 4?

I have databes with 120 000 records in the biggest table. But my application starts to working slowly after inserting of these records. I optimize the indexes of the tables. What other i can do to optimize the queries? To use SQL_CACHE?

!man explain

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

i used explain to see where to add indexes

!man cluster

see http://dev.mysql.com/doc/refman/5.0/en/mysql-cluster-backup-concepts.html

bobby switch the slow query log on and look for the root causes

SELECT DISTINCT trade_shows.show_id, trade_shows.show_image , trade_shows.show_name , trade_shows.start_day , trade_shows.start_month , trade_shows.start_year , trade_shows.end_day , trade_shows.end_month , trade_shows.end_year , trade_shows.show_id , trade_shows.location ,
trade_shows.organizer , trade_shows_industries.industry_id , ref_industries.industry , country.CountryName from trade_shows left join trade_shows_industries on trade_shows.ind

Can anyone see why that would output multiple show_id's?

pastebin you got cut short

multiple rows in trade_shows_industries that match the id.

yep

thanks i didnt know that

snoyes you looked at jaypipes blog?

basically the query outputs exactly the same information, for however many results are in trade_show_industries
I just want it to output one result

you should just group by show_id

hello

haven't seen it today

ah ok, thanks pbro

DISTINCT goes on every field

k

.. and not just the first one.

Are you referring to the picture of Marten?

i am having a series of what appears to be mysql server crashes on a debian server, what should i look at to find out the cause?

snoyes its the benchmark tool name

oh yes, I saw that.
Was going to comment about it, but there's no underscore

yea that worked, thanks pbro

anyone could give me any advice on how to sort multiple rows to keep certain order? i mean how, for example sort something in the way that row with prev_id = x follows a row with id = x

field

ORDER BY FIELD( country, 'US', 'Canada', country ), country; // This will order the list by placing the US first, Canada as second, and the other countries in alphabetical order

Hm, maybe that's not quite what you were after.
sounds like you want to order an adjacency list; that's tricky for mysql.
trees

http://www.dbazine.com/oracle/or-articles/tropashko4 and http://www.sitepoint.com/article/hierarchical-data-database, http://jan.kneschke.de/projects/mysql/sp/ http://jan.kneschke.de/projects/mysql/sp/sp_tree.sql http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql/ http://dev.mysql.com/tech-resources/articles/hierarchical-data.html

easier with a nested set.
or materialized path.

thanks, i will google that i had no idea how to call this way of sorting

can i pipe the output from one select into another? i want to do .. select distinct(ip) from accounting; select sum(amount) from accounting where ip=$ip order by date desc limit 6; but use the ips from the first select in the 2nd

!man subqueries

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

joins

http://hashmysql.org/index.php?title=Introduction_to_Joins - For more indepth info: http://dev.mysql.com/tech-resources/articles/mysql-db-design-ch5.pdf

thank tyou

tcp or socket ?

Hello!
I'm thinking about category tree and I will probably IP.trees.

Hi, I want to set up some backupscript for my sql. mysqldump only requires SELECT, right? (So a GRANT SELECT ON * TO 'backupuser'@'localhost' IDENTIFIED BY 'supersecretpassword' should do it?)

if I have a result set that I want to use in my application, but also use as input for another query, is temporary table what I want?

However, i have some performance questions.

anybode in here uses cluster with mysql 5?
body

amigrave, i would think socket would be quicker than tcp, as there isn;t the static ip hosting header involved
hehe.. would think..

What is faster? 1. Sorting records by 3 fields. 2. Searching by: LIKE "10.5.%" (% only at the end)?

can anyone give some pointers on how to diagnose mysql crashes, i am stuck, and can't find anything helpful on google

thanks

Are you using MySQL's official binaries?

resolve a stack trace, as the crash message suggests. create a repeatable test case and submit a bugreport

SettlerX, what sort of schema are you using?

Can you reproduce the crash?

it's a debian sarge server, so they are debian's version

SettlerX, can you paste bin the "SHOW CREATE TABLE" and indices for it?

Hi there

the server host seemed to stop responding on friday, i restarted it, there was a corrupt table, which I repaired, all was well

trudim test hardware and try mysql.coms versions

I juste got a "Out of memory (Needed 8164 bytes)" error on my MySQL server
with "mysqld got signal 11;" after that

np

this morning all the websites that use mysql were down, everything else on the server is working perfectly

look at .err files and syslog

i am trying to find some log that will point me to the cause of the failure,
the /var/log/mysql.err is empty

is there a way to know what is using so much memory ?

Legor, what sort of system are you running & how much memory do you have?

i'm running Debian 3.4.3-13sarge1 with 8Go RAM

and you need MySQL to use all 8gb of ram? you 64bit from system to userland?

i don't know if i need so much memory, thoug top gives very few free memory
yes this is a 64bits system

check the output of free -m
and make sure the mysql you're using is native 64bit

what should i check in "free -m" command ?

ugh

Legor, how much is being used for buffers & cached while mysql's running
basically you're trying to work out if MySQL is hitting an imposed limit, or a hard system limit

mysql is running now and i have 5054 used for buffers/cache

k, so you're only using ~3gbish
you know what explicitly triggers mysql to run out of memory
e.g. can you replicate the problem all the time?

no i don't
and unfortunately no i can't reproduce the problem on demand
i can only wait and see that it happens

can you upload your my.cnf somewhere

yep
to you know some upload site ?

it might be something silly like having too large per-client buffers, getting a sudden spike and needing 8 bazillion gigabytes
uh. paste2.org

i think i have standard config

ah paste it anyway

i only had to change max_heap_table_size and tmp_table_size to 1024M
here you go :
http://paste2.org/p/5303
what do you think of it HarryR ?

uh, is this a dedicated MySQL machine?

Is there a my.cnf equivalent to skip-name-resolve?
Or is that option only possible through the command line startup?

Legor, you're using the very small defaults, on a system with 8gb of memory you can push some of these up quite a bit

yes it runs only mysql
which one for example ?

Typically the command line options work in my.cnf, just lead off the leading –

you can probably increase the key buffer to a GB or two
query cache upto 32 or 64mb

actually i had a previous conf with higher values, but the servers crashes frequently with "mysql got signal 11" error

ok, it looks like you're running the 32bit executable then
go and get the 64bit build of MySQL so it can actually access 8gb of your memory
instead of getting killed off when it tries to access more than ~3.5gb

how do you see that ?

k..I'll give it a try. Thanks

It's a guess based on what I've seen so far

Legor, see the my-huge.ini example file

e.g. http://atonal.ucdavis.edu/matlab/database/mysql/my-huge.ini

and how can i check i'm running the 64 bits exe ?

if you run `file /path/to/mysqld` it'll tell you the ELF header

wait for a while..

e.g. ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.4.1, dynamically linked (uses shared libs), stripped

what is the "file" command ? i don't have that on my system

it works out the filetype based on a set of configurable rules, so if you're unsure of what a file is you run "file" against it and it matches it against known formats
Which distribution are you using?

thank you, snoyes. worked perfectly. I had tried that before, but I had put –skip-hostname-resolve in the my.cnf file by mistake. It worked now that I typed it correctl.

Legor, show variables

Hi Guys, how to enable mysql to allow remote connections, ie. from another machine in the office?

external

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

show variables gives the following :
version 5.0.41-Dotdeb_1.dotdeb.2
version_comment Dotdeb Etch backport
version_compile_machine i486
version_compile_os pc-linux-gnu

486 there you go

sounds good ?

no thats 32 bit

so it's definately 32-bit, so you won't be able to use more than half of the memory on your system
which is probably why you're getting memory allocation problems under high load
Legor, are you using Intel, AMD or other processors?

AMD64

k, when you run uname -m you get x86_64 right?

exactly !

which distro are you using?

Debian 3.4.3-13sarge1

oh sorry, I forgot

np

hello

hello Nomalz

Legor, check http://dev.mysql.com/downloads/mysql/5.0.html#ubuntu and make sure you get the AMD64 server

HarryR i introduce to my server admin Nomalz

and associated packages, I can't find just a plain non-rpm or deb version of the AMD64 build
Hi Nomalz

hi
We used the dotdeb debian package version

the AMD64 build?

on debian 3.1 that we built with amd64 "experimental" kernel
(debian 4.0 wasn't released when we installed it)
i don't know which version it is :o

9' DAY_MINUTE

wait pls

Nomalz, k, the only thing that seems to have gone wrong was that you installed the 32bit version build and not the 64-bit build

mysql-server-5.0 5.0.41-1.dotdeb.2 MySQL database server binaries
yep it's possible
but how can the server host use all of its ram (8go) with a 32bits version ?

it cant…

total used free shared buffers cached
8110064 7416620 693444 0 37104 1256460

the rest of the memory usage is just disk buffers & caches

3.4gb for disk buffers & caches ? is it possible ?

yeah

oh
not cool

Normalz, MySQL itself can't but if you're using MyISAM tables the 4.5GB that MySQL can't use directly will be used by the OS to cache the data rows. MySQL doesn't cache MyISAM data rows itself so this can be useful.

ok

Since the 32 bit server is also faster than the 64 bit server unless you need to have MySQL itself allocate more than 3.5GB, if you are using MyISAM and need that amount of OS cache for your data, there would be no reason to switch to the 64 bit version.

Jamesday, or like… if you have lots of clients and want to have reasonable buffers for them and were running into problems like.. running out of memory

the major part of our data is myISAM
we had the out of memory problem today only
but we had a few crashes with no explaination

how much load is the server under?

on this server and another one, which has the same ocnfiguration
very loaded
and the database is huge

and you're running with a 16mb key buffer on a box with 8gb ram?
that's 16mb for the whole of that mysql instance

we changed the value
to test

ah k

but we may need a little help on the conf part
we hade key_buffer_size = 768M before
but since it crashed, we tried the default conf…
on our first server (lelit), there is a big database which has 1.4go of MEMORY table and 1go of MyISAM table
2.4go
+others database which are about 400mo in total
is 8 gb sufficient for this kind of database ?

yes

ok
it's a first step
the serv has 288 query / s

how many average connections do you have?

between 150 and 250
if there is a configuration template for high loaded server like ours, it could help

are there any good resources out there to go to for more advanced help with join syntax? the mysql documentation on joins leaves a lot to be desired

joins

http://hashmysql.org/index.php?title=Introduction_to_Joins - For more indepth info: http://dev.mysql.com/tech-resources/articles/mysql-db-design-ch5.pdf

problem is, if you've got 250 clients at maybe 6mb each per active thread, 768mb key buffers & 1gb maxium temporary table size, you're going to hit the 32bit limit fairly quickly

what about this conf file ? http://atonal.ucdavis.edu/matlab/database/mysql/my-huge.ini

yep :
would mysql enterprise give us a little help with all of this (better management & maybe more support for crashes) ?

it's very likely, but so would understanding why you're getting these issues and what you can do to resolve them
it's very likely, but so would understanding why you're getting these issues and what you can do to resolve them

k, thx HarryR

thanks guys

don't forget to thank the bots!

http://phpfi.com/253330 - but is it helpful for you?
the second: http://phpfi.com/253331
LIKE: "1.17.15.%"

Normal, Enterprise would give you MySQL support engineers to check why your'e crashing (but you'd need Platinum level for performance tuning beyond that)

the second way - we find categories by sorting by: master, step, name (from another table) - so with JOIN

Normalz, it's probably per-session variables liek sort_buffer_size that are too large.

and in the first case - without JOIN
but how is it with performance of LIKE with % in the end?

we're talking about the error "mysqld got signal 11", right ?

is it faster or slower than sorting records by these 3 fields?

Normalz, yes

we have another server which is less loaded and with the standard conf. it has 8go of ram (only use about 4 ou 5 go) and still has about one crash per month !

SettlerX, Like with on the end will use an index if one is available and also can be used for the rest of your join. It's very fast.

so i don't really think that it's a conf value problem, since even the basic conf on a huge computer makes crashes

Nomal, then you definitely need to look at your my.cnf settings to see where the RAM is being allocated and see if youre per-session allocations are too large.

the standard conf provided with mysqld can be too large ??

Nomalz, I don't recall how debian configures it. Standard configuration can allocate too little RAM for key_buffer_size so your queries are slow and your connections build up to the point that you run out of RAM.

that's an neverending problem

Nomalz, also need to look at your indexes and queries to ensure that those are efficient
But can start with my.cnf checkout first to see if that's reasonable.

yep, that's Legor job :p
i'll probably go with the my-huge.cnf

Nomalz, or mine if I wasn't on vacation
Nomal, tha'ts a good start anyway - there's nothing grossly wrong with that one and it does allocate sensible buffer sizes

yep, i think queries are mostly optimized, unless there is some that were forgotten…
Jamesday, any chance we have further information about crash looking at the backtrace ?

with "1.5.17" method (it's a path) i don't need joins. It would be an index. If it's fast, so i will implement it.

Legor, not when I'm on vacation
Legor, see how it does with my-huge.ini and can adjust from there.

ok Nomalz will have a look at that
do you think bad my.cnf can trigger "signal 11" crash ?

If you do get stuck, toss some money MySQL's way But that pays my wages so I'm biased

No wireless at the beach? Totally unacceptable.

Legor, easily
Legor, I've seen people have setups that at the maximum connections they allowed could use several terrabytes of RAM
Legor, I've seen people have setups that at the maximum connections they allowed could use several terrabytes of RAM

so our only way is to adjust the conf each time that the server crashes

Nested trees (left+right), all connections (e.g. 1-2, 1-3, 2-3) with depth, recurenction - they are more problematic
I have heard that Microsoft uses IP.trees - true?

they also use the blood of puppies

Nomalz, or you can watch memory allocation to see it rising. Or cut back on sort_buffer_size and the other per-session variables

evil doers

DSal-Rak: can you extent your words?
*Extend

Your load doesn't sound high for the box you have so it's probably just tuning
Though when you crash, don't trust he automatic MyISAM table check - do a manual check table for each table to be sure.

that what we do
we always have one to three crashed tables
that block our scripts

what will happen if we don't check tables manually ?

(that's how we know that mysqld crashed…)

Corrupt tables can cause the server to crash. Can end up with a nasty cycle

we have MEMORY table that we use for rankings (it's being recalculated each 30mn, and each table is 700mb), maybe it could be better if we converted theses tables to MyISAM ?

Worth a look at your mysql error log file as well to see what it's complaining about - see if it's complaining about being unable to allocate RAM
Nomalz, why do you need memory tables? What is the operation that you're doing with them that caused you to use them originally?

we neved had any ram error before today, and it's only because we switched our conf to the standard conf to test
our main problem is error 11 crashs without any other error (mysql.err staying empty)

Nomalz, so your own config worked, standard causes crashes?

standard caused crashes quicker

ah, quiker is OK - so need to compare yours to standard and see what he differences are
how many sort_merge_asses do you see in show global status?
sort_merge_passes rather

also standard causes "Out of memory" error

hi!

Therion, I'm not here, you don' tsee me, I'm an illusion Hi

The differences are mainly the per session value, which were bigger than the "my-huge.cnf"

wherease own config gives only "signal 11" error without mor information

hehe

Nomalz, OK, which ones are bigger, which smaller and what does sort_merge_passes say?

sort_merge_asses: 617 (it's still running with the standard conf now, so i don't know if the value is really useful)

OK, how much uptime for that?

from smaller to bigger : standard conf my-huge.cnf our previous conf
1 hour and 28 mn

Nomal, interesting.
I have a stuck z key btw

^^

what is sort_buffer_size?
in each config?

in standard, there is no sort_buffer_size
in my-huge, sort_buffer_size = 2M
in our previous conf, sort_buffer_size = 32M

32mb per client! ouch

OK. right HarryR
Nomalz, OK, calculate sort merge passes per second with current setting

current is standard

two show global status 5 minutes apart, subtract values, divide by difference in uptime
Then try sort_buffer_size = 4M and see what difference that makes to the rate of sort_merge_passes. Adjust until you have found the lowest value of sort_buffer_size that doesn't make sort_merge_passes increase t a fast rate.

ERROR 1148 (42000): The used command is not allowed with this MySQL version
but i cant see what ia m doing wrong
LOAD DATA LOCAL INFILE '/home/cot.co.uk/autofiles/cotmembers.csv1' INTO TABLE members FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' thats what i am doing in mysql 4.1

k, i see

Nomalz, sort_merge_passes aren't very expensive so a few per second is fine.
that may mean lowering your sort_buffer_size value below 2M - if so, do that

http://pastebin.com/m79bdfeb1
(our confs)
my-huge.cnf is the conf that we are gonna use soon
at the next restart
we'll see if it goes better…

Nomal, choke…
max_heap_table_size = 1024M
tmp_table_size = 1024M
those are… somewhat large

yep
but our memory tables are 700mb large
if we don't use theses values, mysql says "table is full"

we may use MyISAM talbes instead, as suggested Nomalz before

and do you use 1GB temporary tables that have to be all in RAM?
that one can probably be smaller

Legor knows better than me the utility of theses tables

do you think it could help to use MyISAM rather than MEMORY ?

BDB!

Hi domas

Hi!

Nomalz, maybe

we designed MEMORY tables because there is a lot of access to this table and we wanted to make sure the server has data in his cache

Nomalz, show global status, what are the temporary table lines saying

that works with innodb too ;-) )

Created_tmp_disk_tables 67

innodb is perfect for hot stuff

Created_tmp_files 834
Created_tmp_tables 15 k
is that what you wanted ?

how to choose between innodb and memory TW ?

TW is the country!

oops :$

are you asking whole country to help you?

^^

Lower max_tmp_table_size to 8M then adjust until the created_tmp_disk_tables rate is about 4-5 per second

lol nope of course

if you have 700MB, you choose innodb, its easy ;-)
just turn off the log flushing

could you say why ?

finegrained locking ;-)

if we lower max_tmp_table_size to 8M, mysql won't allow us to put 700mb in our table

the maximum temporary tables sie is probably why you're crashing

or am i wrong ?

of course, BDB rocks too ;-)

Nomalz, so don't create it as a temporary memory table, create it as a memory table instead

it is a memory table !

what is create table for it?
max_tmp_table_size doesn't limit the size of memory tables - unless you've found a nice new bug

ok
so we can lower this value
ENGINE=MEMORY DEFAULT CHARSET=latin1 AUTO_INCREMENT=2660036 ;

doms could you advise when using InnoDB, BDB, MyISAM, Memory ,
?

and then all the connectiosn that need temporary tables for other reasons wont' allocate 1GB of RAM

ok, that may be better ^^

all data is cached in memory, let it be myisam, innodb or whatever

that will probably stop your crashes

there's just a question if it is backed by physical disk

what about the other values of the my-huge.cnf ? it seems ok ? ( http://pastebin.com/m79bdfeb1 )

and how well backed

then you can think about other changes liek memory or myisam or innodb choice

how many changes are you getting, etc

467

whoah
that was Therion

it can stop our crashes, but remember that we have another server with the same hardware, more database but less loaded, with the standard mysql conf (so without tmp_table_size !) and it still crashes (but less often, i admit)

Nomalz, successive refinement time after this - to allocate as much RAM as is needed and no more to the buffers - will gradually get there
domas, is there a pre-conference yet?

mmm, we're doing sightseeing now mostly
the 'conference' starts at 1st

sightseeing sounds good

well, except that it is 35C and 100% humidity

oops. seeing your pretty computer sights sounds good

nah, did spend whole day out
did have some tropical rain showers today
with lightning in close proximity every few seconds

guys, thx for your advices

yep, thanks a lot
if it continues crashing, i'll come back when you're out of your holidays ^^

domas, our MEMORY table is a huge table (2.5M records) with a lot of SELECT
which engine would you adivse ?

Hey Seekwill

oh no, I'm being singled out

I got a question for you if you have a minute

Nomalz, Legor, heh, just catch me when I'm eating dinner again. going back to playing games now

how to contact you ? you're always here, or maybe i can ask your mail ?

Why me?

I was told you might know

There are 429 other people who might know better than me…

Nomalz, you can't reliably catch me - I'm not normally here.
heh seekwill

To much presure ? hehe

oh

Nomalz, as domas said, subscribing to enterprise can catch me - I'm oone of MySQL's support engineers.

Like, look at Jamesday. He like, invented wikipedia with domas

hey Kaj!

k

hey Domas!

seekwill, heh, you're telling people all of our secrets

Ah, you work for them?

TW= Taiwan?

yep!

HI kaj

OH I didn't know it was a secret!

wow!
hi Jamesday!

wikimania!

Seriously ? I use wikipedia all the time

cool, I might be in TW in a month or so

I'm leaving in ~9 days
I guess will miss you ;-)

9 days, that's a long time!

yup, lots of stuff ahead

You are in the presence of the higher power. Bow down or ask a question for infinite wisdom

I should have arranged to visit teh apac group and had the travel coincide with wikimania. But travel… long distance travel.. yuck

lol

http://commons.wikimedia.org/wiki/Image:Wm07warm_up_party.JPG \o/
its already up there

listen to seekwill

I have a table, indexed with 1 row. A query such as "select id from table where id=3" takes 63ms. Why does it take so long?
It should take about 3ms
Also the computer is 100% idle, and has enough memory. Also it's a 2.4ghz quadcore machine.

context switching

disks arn't that fast yet

\o/

context switching?

How did you come up with 3ms?

I can use the memory engine with this table and it still takes 63ms

well, queries have to take less than 1ms usually
then test timing error!

On my other machine, that is the time the query takes

Use the other machine then

lol

perljunkie2, I was first DBA for wikipedia, domas is current. both of us work for mysql as support engineers. So if anyone ever says MySQL support doens' have people with a clue about real world big systems… .

or DNS

what else is that machine doing

or TCP connection

is it a winbox

actually there's no clue about real world
who says wp is a real world

heh

well, look where it is waiting
can be anything in the stack

ok. It's unreal that the place can raise a million dollars in donations

usually a proper database server returns in ~1ms

Can one reset the counter that MySQL uses for auto_increment?

it doesnot
ALTER TABLE

domas|TW, Thanks, I'll check that …

How do I figure out where it is hanging?

strace -t or what was the switch
-r?

domas|TW, Are you sure? "help alter table" doesn't seem to show anything allowing me to reset the counter.

see you

yes, I'm sure ;-)
mysql.com/alter+table

domas, you need to work out how many of those Taiwanese girls you can pack and where you will store them in your apartment.

lol wtf

domas|TW, Thanks - found it: ALTER TABLE t2 AUTO_INCREMENT = value;

naaah, its always nice to come here!
ant there's typhoon incoming
never saw a typhoon
should be fun.
I already enjoyed what they call 'rain' here
its probably 'storm of the century' back in europe

lol

domas, typhoon? you should arrange to visit florida dring a hurricane to complete the set

mmhmmm, would have to do disaster migration stuff

get people to migrate the servers first

no!
thats not fun

lol

if we migrate servers before disaster, no way to ask for donations

ah! an evil plan!

Anybody a fan of UserFriendly? Does Domas remind you of anyone?

Dogbert

dogbert?
hahaha

haha

seekwill, hahahahaha

Could the ms delay be due to an old OS (rh3) or old mysql (4.x) ?

no

how do you drop tables? is it simply "DROP TABLE tablename;" ?

RH3 or RHEL3?
it is

ok ty

RH3 is yes, pretty old
you can expect anything with it

lol rh3…

2 EDT

thats probably not RH3

what is it then?

RHEL3
;-)

what's the difference ?

RH3 is very very VERY old

6 years

lol ok

probably

nope, older
March 1996
thats 11 years

9 years from rhel3
still ancient

rhel3 = Oct 2003

lol http://ars.userfriendly.org/cartoons/?id=20070726

hehe wysiwtf

hehe
I can't get any work down when the company VPN is down!

The company VPN is always down it seems.

in the immortal words of jazz…. "what up bitches?"

I did the strace. It appears to take 20ms unless I am reading the times incorrectly. http://rafb.net/p/7X2kdk80.html
1185812089.268749 to 1185812089.281307
I'm not even sure what that means I guess

is it possible to have more than just two 'masters' in a master-master replication situation? all the howto's only seem to ever document 2 servers

JerJer, you can do circular replication
JerJer, you can't do star or similar however

Hi. I have a query which spends a 99% of its time in the "Sending data" state. What can I deduce from that ? What else is interesting to look at in such case ?

Subdino, and the query is?

ugh … so circular sends it from one server to another to back to first server (eventually) ?

Subdino, eg. asking for too much data , select * or a poor use of a limit

JerJer, yes, it goes in a circle

what level of detail do you want ? basicaly, select sum(my_column) from my_table where [15 boolean operators, around 4 inegality operators, 8 egality operators]

A

is that why they call it circular replication?

Subdino, that sounds like a full table scan

The strace says my query is taking 16ms, The interface says 63ms

"explain" gives a index_merge with extra "Using intersect(payment_uid,resource_uid); Using where"

xzilla, yes sir, tricky naming!

3210 rows estimation, table has 16 columns: 9 bigint, 2 double, 1 datetime, 4 varchar
I really don't get what this execution state means… transfered data should not be so big, so I guess time is spent in "processing rows" part as described on general-thread-states.html, but I have no clue what it really means
is it the cost of the index merge ?
intersect, I mean

dunno it may be, can you simplify it at all

afternoon all. in an explain, will a DERIVED table always show "using temporary"?

Yes

i wasn't sure. i knew it was a temp table, but didn't know if it would tell me that i'll stop trying to find a way to optimzize the temp table out then

Joins, Groups, and Subqueries

??

They all use temp tables

joins don't unless you are joining more than your buffers allow
groups you can get away from if you do it right

not always

I thought it was. Interesting

if index can be used, temporary tables are not used

maybe my buffer is to small

so back to my question. on a DERIVED table should i continue trying to optimize out the using temporary? or is that informational (because it is HAS to be a temporary table)
(by DERIVEd i mean a subquery in the FROM clause)

hey guys, im doing a fulltext search to grab some rows from a Postings table, at the same time I want to know if the user doing the searching has previously viewed the posting, this data is stored in two tables eg. tableA[guide_id,user_id] tableB[guide_id,posting_id] ..iv been trying some
joins but all I can get is ONLY the postings the user has viewed and not all postings from the search and extra data for th

do you have any mysql book recommendations .. a coworker just asked me about mysql books
the only good one i know is mysql performance tuning
but its a bit dated .. and focuses on a specific subset of mysql
pro mysql seemed ok from the sample chapter i skimmed a while back

SELECT * FROM postings, tableA, tableB WHERE tableB.posting_id=postings.posting_id AND tableA.guide_id=tabelB.guide_id AND tableA.user_id=123; - this doesn't really work as it only returns postings the user has viewed before
uSELECT * FROM postings, tableA, tableB WHERE tableB.posting_id=postings.posting_id AND tableA.guide_id=tabelB.guide_id AND tableA.user_id=123; - this doesn't really work as it only returns postings the user has viewed before/u

mmm, nope, didn't read any

I thought 'high performance mysql' was a little too basic.

neither have i

SOURCE CODE!

hehe

i have only read generic sql books

didn't buy it after browsing it in the bookstore. There was only a couple chapters not covered in every other SQL book

book

http://www.kitebird.com/mysql-book

and o really mysql stored procedure programming

Just read the log history of this channel.

archivist

the bot keeper at the moment

hehe

er yes

it's a pretty sweet bot actually

domas
heheee

dammit

We have 4 (soon 5) physical locations that the powers that be want to have all of our data 'replicated' at all location… would circular work for this sitaution?

\monster\: Use an outer join, not inner join, when looking for rows of one table that are not associated with rows of another table. The alternative is using NOT EXISTS (…).

JerJer, possibly, assuming you know the limitations of circular

\monster\: or NOT IN (…)

ok ill play with that

what about mysql performance blog ?

\monster\: Listen to the_wench …
a not in b

SELECT a.* FROM a LEFT JOIN b ON a.id = b.id WHERE b.id IS NULL;

what about the mysql cluster stuff? assuming we wrote our apps to be aware of the read-only versus write-only. would that be 'better' ?

SELECT SQL_CALC_FOUND_ROWS posting_sl.posting_id, MATCH (desc_long,desc_short,response,ota_keywords,page_title,meta_keywords,meta_description,summary) AGAINST ('java') AS sort_by, study_guide.*, study_guide_record.*
FROM
oops
ignore that

\monster\: Ignore what?

accidental paste

\monster\: What paste?

JerJer, mysql cluster is not designed for geographical replication

ok - good to know

a not in b ..example would only return rows not present in b wouldn't it?

\monster\: That's the idea.

ok, now what im looking to do is do a normal search on one table and also grab info regarding past views for each posting returned for the user doing the search
maybe im making sense here, not too sure
maybe ill pastebin the actual query im trying

\monster\: The example shows you how to obtain the missing rows. Just remove that WHERE criteria to see them all, noting that nulls in the right table represent those not viewed (not found).

quick question for ya, how hard was it to get the_wench to post the correct url's for !man ? did you have to index the page or does it just post a search?

define incorrect

heh

it uses mysql xml index terms
which are borked

hmm this is sql 101, i think iv had a different issue on friday, checks

You're taking a class on SQL?

thanks
(but that stinks about the xml being messed)

nope, just saying what Xgc is describing is basic stuff so i think iv had another problem
bnope, just saying what Xgc is describing is basic stuff so i think iv had another problem/b

fatpelt its been entertaining making a reader

\monster\: Not knowing anything about tableA and tableB (in your example) makes it hard to propose a direct solution. What does tableA and tableB represent?

need to nuke this coffee
one min i think i can do a better job describing this heh

any good books on data structures in sql?
like storing trees

trees

http://www.dbazine.com/oracle/or-articles/tropashko4 and http://www.sitepoint.com/article/hierarchical-data-database, http://jan.kneschke.de/projects/mysql/sp/ http://jan.kneschke.de/projects/mysql/sp/sp_tree.sql http://www.vbmysql.com/articles/database-design/managing-hierarchical-data-in-mysql/ http://dev.mysql.com/tech-resources/articles/hierarchical-data.html

amazing…..

hi
how to dump a single table?

mysqldump

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

fatpelt thats how we cheat ^^^ with bad index terms

Hey, is there anyone able to lend me a hand? Thanks.

this one is php-mysql and is in 3 mysql chans

it is written in php? what do you use to connect to the channel? (i found Smart_IRC and i'm not sure about it yet)

Hey, is there anyone able to lend me a hand? Thanks. [MYSQL]

its got smart_irc in the core
ask

"I have a question", Don't ask: "Is anyone around?" or "Can anyone help?". Just Ask The Question. Also, please read: http://workaround.org/moin/GettingHelpOnIrc

i guess i'll stick with it then

Yah but it's work related, so I don't want to give out sensative information, the_wench.

hehe

if you want private support and hand holding mysql.com/enterprise

Lol, archivist, that won't help either
I've already wiki'd everything, seen it etc, now I need someone to help, wether I'm going crazy or it is a genuine problem within a host or the script

quite a deal……

can't do sub-selects in mysql? like select * from foo where foo_id in (select * from bar); ?

!man subqueries

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

Zaki, did you try it

Anyone know why some system variables, specifically innodb ones cannot be selected like 'select @@innodb.buffer_pool_size;' but others can?

ok http://pastebin.com/d3237c990 is my actual query, i want to get all rows from posting_sl table and match if possible rows from the other two tables, what I have there returns only rows from posting_sl that match the WHERe clause
user_id field is in study_guide table

errr "select @@innodb_buffer_pool_size; "

Basically, my client's website is MYSQL powered [eg, all the information, bios etc]. Moved server, everything setup accordingly, the backup was executed perfectly but none of it shows on the pages [ bios etc] which is from within the database..

EvanLugh, are you getting any sort of error?

nope
thats the weird thing, no error
the information just *doesn't* output

are you sure it isn't a rights issue?

rights issue? Please explain

often times sites suppress error messages. something like a "Access Denied" type thing

oh, nope no error or anything everything is fine apart from the information not outputting!
www.lucy-anne.co.uk/index.php [it's for a model website, No XXX]
you should see the disclaimer

Oh, no XXX? Blah, don't need to click it then

well above that, should be the information taken from the sql database, it should give an error should the database info be wrong
haha
and under the stats box

how to cast the type of output values of a subquery?!

EvanLugh, not if you have error reporting off

it's on
YES messgae or whatever
message*

what happens if you run one of the queries in something like Query Browser ?

what's that?

thats a program message not an error message

!man query browser

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

+Sorry, I'm not good when it comes to SQL, edit variables is all :p
u+Sorry, I'm not good when it comes to SQL, edit variables is all :p/u

fatpelt as I said index terms suck

hehe

also
it worked before I upgraded the plan with the host
so i contacted them many times

did your ip addresses change in this ?

but they didnt say it was on their side
huh?

think i figured out a solution to my issue, wee

change in what exactly
monster lucky :P

it seems that enterprise really wouldn't help here….

hey, is it possible to write a select statement that will select where a condition is met in any of the table's fields ? ie. for a search feature

are the ip addresses different from before when it worked ?

fatpelt, i don't see how/why the ip should affect it
an ip*

answer the stupid question

LOL

(it could matter)

ip address of what exactly?!!
the sql host ?

the db server and or the webserver. you said you migrated the system

oh
yes they did, but I changed all of the variables

(did /me misunderstand)
did you make any modifications in the mysql.* tables?

it's with 1+1 like, 1009@1+1.com _
Yes, fatpelt

EvanLugh, the php may override the error reporting settings

did you "flush privileges" ?

flush prileges?

a phpinfo() will tell you what your error logs is

um
ok

after you made changes in the mysql.* tables did you either a) restart the server or b) flush privileges

nope neither and i never edited the tables just the backup database settings

er… s/error logs/error reporting/

how to create a table from a query?

because this is the third time we've changed to make sure no downtime is occuring, and i've done everything like I have the second time, only the second time it worked fine :P

!man create table

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

this was my last resort too :X
i already phoned 1+1 approx. 4 times

is it possible to setup a mysql 5.0.42 slave to replicate a 4.1.22 master?

did your ip addresses change the other time you migrated?

Hi EvanLugh. My name is Evan too.

perljunkie2 = High five
fatpelt= hostname did
or my ip? My IP changes all the time /dynamic

"select * from #mysql where real_name='evan'"

432

it all depends on how the rights are set up in the mysql.* tables as to if it is hostname or ip address specific

fatpelt= yah already edited those variables

What is the error message exactly?

there isn't one
:p

hmm. something is wrong with my query, my name isn't evan and there are 431 people here….

that's the confuzziling part

so back to my first question, did you then restart the server or flush privileges ?

I think one left sense your query

we cant restart it and no how do i flush priveleges
bah i gotta go for 30 mins, would i be possible you could tell me in a priv chat, fatpelt? OTHerwise I'll miss your answer
I really appreciate your help

We will just halt all conversations here until you return.
Hurry.

haha

nope. sorry

Everyone play world of warcraft for 30 minutes till Evan gets back

hehe

Good plan, I wish

how to rename a table :P ?
create table foo from select * from bar;

!man alter table

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

then drop table bar ?
ok

!man rename table

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

thanks alot weign and all

when "im Weierächer" is 13 bytes long and it also has 13 characters, then it is not saved in UTF-8 format, correct?

how to get the integer value of a string?
string = varchar field

It will implicitly cast as needed, or you can use the CAST() function.
!man cast

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

!man adding new user

see http://dev.mysql.com/doc/refman/5.0/en/adding-users.html

Can someone point me to a How-to on how to restore a dump from a remote server, to the local server I am working on now?
I allready grabbed the *.sql file, but my attempts to locally restore it, has failed numerous times.
o.o

you can't just mysql -uUSER -pPASS database backup.sql ?

nope

hey all can someone direct me to the link that explains how to export results to a file? I did it once before but forgot the synatax and can't find it on mysql website

hihi im back

SELECT … [INTO OUTFILE 'file_name' export_options
Etc.

k thanks!

how can i flush priveleges in phpmyadmin
please*

why not just flush them in the mysql console?

i dont know how, it was suggested earlier because im having problems

select *,foo/bar as foobar from .. where foobar 10; "unknown column foobar in where clause" - This surprises me, i was so sure that using "as" allows me to use the name later in the where clause.. no?

its simply, FLUSH PRIVILEGES;

ok where do i put that?
!man flush

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

./mysql -u root -p type ur password in use your data base then type it

99; is being auto limited by something at 1000 rows

which variable/setting is that that I've recently stumbled against

!man outfile

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

lokieee, was that for me? nothing popped up after a bout of rtfm

anyone happen to know the export_options to outfile that will save the nice lines/table that sql select usually produces? instead of just the data? I'm using into outfile '/root/devicesOut.txt' but the .txt is just the data, and its not nicely formatted but I can't seem to find that option
kitchen no that was for me

Nope. But you can use a HAVING clause instead.

mysql dbname export.sql ?

SELECT …, expr as foobar FROM … HAVING foobar 10;

there's a flag for that on the cli tool

does anyone know if mysql dependent packages like zlib, openssl, libgcc are available by yum in 64 bit?

mysql -t …

if I had used INSERT DELAYED I might see it as delayed_queue_size is 1000

fatbelt, you alive yet, still need your help and I have some more info :P

fife_out.sql

woops

rofl

lol

*scans for site*
JK

luckly its local host

grr is it easy to fix that my php files don't seem to be connecting to the databases?
haha
or is there a certain chmod eg 677 or 777

677?
You want it rw by the mysql user
Make sure mysql owns it

Hey I am trying to create a table that uses the memory engine
and I need to save text data

it already is 677

of unknown lenght

so basically, the php files have the correct variables to send and retrieve/output the information into other php files [index.php].. but aren't

but it says that The used table type doesn't support BLOB/TEXT columns
is their another way?

they dont seem to be connecting to the mysql database(s)

do you have shell access to the webserver?

i want to add a n:n relationship to every field in every table of my database, to be able to add "sources" for every bit of information

hey fatpelt
nope

would i end up with a sources table and a linking table with keys "table" and "id"?

i deleted the database
and nothing changed
no errors
so im guessing, the php files weren't contacting the mysql databases
to retrieve the info

or maybe a separate linking table for every data table?

anyone got some input on this? freebsd 5.3

do a phpinfo() and see what your error reporting is.

mario# mysql_upgrade
mysql
Can't find 'mysql'

ok hold on fatpelt
fatpelt
http://lucy-anne.co.uk/phpinfo.php
a href="http://lucy-anne.co.uk/phpinfo.php"http://lucy-anne.co.uk/phpinfo.php/a

what connection method are you using?

connection method? eg- FTP?

for mysql. pdo/mysql/mysqli

is there an expectation of when 5.1.x will be made GA?

I expect it tomorrow.

back
mysql fatpelt

GA?

does your code look like this $conn = @mysql_connect(…) ?

or maybe I should ask if there is a published timeline?

general availability

johnny generally available

oh..

yes fatpelt

ie marked as stable

the @ supresses the error

that's what i just say

here's a part of one
$cn_models = mysql_pconnect($

please help!

DavidHKMrPowers, please read http://catb.org/~esr/faqs/smart-questions.html

SELECT `A`.`a`, `B`.`b`…… how to mix them together to become one column?

don't say another word in here until you do

say, column a is "file://" , column b is "install.bat"

you could always say H. E. L. P [ it's not a word, it's scrambled letters! :P ]

please h.e.l.p

i was joking _

\o/

Any ideas, fatpelt? OR do you need more info from me xD

do as johnny said and read that url

fatpelt ok..
but it's not related to my question

you won't get any answers until you read it

and would it be a good idea to recreate the database, so that I can see if it connects as of yet, fatpelt?

that url i believe is related to any question

fatpelt, nice response.. i'll use that

i wonder if i should have said "that url is related to every question"

i suppose.

it still feels like a permission problem. where the user that you are trying to connect as does not have rights to the database
that's just me being picky though

Ok I am getting ready ro move from one server to another. Now both the servers are running 5.0.27 the Database uses InnoDB the binary file is 67GB. Now i need to move the site with the least about of downtime. any ideas?

Ok fatpelt, so what should I do? It's frustrating, fifth day with this problem!
It's all chmod to 677 already =s

EvanLugh, same thing here

Should i setup replication on the servers and have the new server be the slave?

but i wait patiently just like everybody else..

!man permission

see http://dev.mysql.com/doc/refman/5.0/en/query-speed.html
see a href="http://dev.mysql.com/doc/refman/5.0/en/query-speed.html"http://dev.mysql.com/doc/refman/5.0/en/query-speed.html/a

huh? does that answer have anything to do with the question?

What isyour problem?

how to make columns other than the primary key column unique?

that's a good way.

UNI

sorry that was for EvanLugh but it messed up

!man unique
?

see http://dev.mysql.com/doc/refman/5.0/en/constraint-primary-key.html

make the field not null and unique

fatpelt, i know
i was suprised at the answer

But can the slave handle changes while it is a slave ?

call me Evan must be annoying writing EvanLugh all the time _

altho i don't realy know how to query the thing personally, i could tell that answer was wrong
tab completion
so not really

EvanLugh just type ev then hit tab

as long as there are no EvanSomethinelse

well blow me
ok well that just did it for me johnny XD

i'm doing that not for your benefit, but for everyone else's
i don't know what to tell you. it seems like the webserver doesn't have permissions to connect. i could be wrong there, but that's what it seems like

Right, fatpelt, I'm editing all the variables for a new database now, and making the database, then I'll add the backup and let you know if it works, which it presumably won't considering it'll be the 4th try.

seekwill, my problem is such that i'm working on an open source project, which is a moudle for a cms type system , it does comments

does any of you have a function that would replace a certain word in each of all fields in a db?

it is implemented with some hybrid nested set and something else model
so i'm trying to bring it inline with it's true nested set roots

i start to like mysql

Were you working with Xgc?

correct
he was a big help

Oh good luck then I'd stick with him

how is mysql comparing with postgresql?

hi

now i'm trying to reorder the results by the thread head

I will to known how to import a backup made with mysqlhotcopy ?

adding backup now

seekwill, i'm trying to spread the joy around

i would like*

lol
being somebody's personal tech slave is no fun.. so i was trying not to mention his name
err his/her …

DavidHKMrPowers http://monstera.man.poznan.pl/wiki/index.php/Mysql_vs_postgres

DavidHKMrPowers, it's faster last i remember..

Comments

I have a database table that stores a username and the date when a user loggedin if the user presses the logout

method()
even though it's a static call, $this is available still
it's voodoo
^^ for you

mmk
thanks

np

nham…other question, where i donwload Apache?

http
blah
http://httpd.apache.org
there is again Win32 binaries

thanks xD

Thank you, I should've known that Davey!

Delixe:

any recommendations for a unit testing framework?
phpunit was uhhh, painful.
or is this seriously a lost cause, as i've been told?

What's the most common XMLRPC implementation? (I have full access to the server)

anyone know how to set up curl

hey y'all

server or client?
the extension?

client, I guess. does it matter?

check out the one in Zend Framework, it's pretty good
and the nicest API

i was like here 2 days ago looking for a decent HTML tree parser ( php4 compatible ), still can't find anything have been trying to write one, but its a total bitch :[

PEAR has the HTML_SaxParser IIR
C

weird I thought there were native versions

there is the xmlrpc extension, and the immature xmlrpci extension (client only)

I guess i'll take a look at zend, thanks

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

http://us3.php.net/manual/en/ref.curl.php

*reads*

http://pear.php.net/package/XML_HTMLSax for the older stable version
what are you trying to do with CURL?

this i am assuming
nuttin much
play with it\

if you're *making* standard GET requests, the http stream is far superior
if not, maybe HTTP_Client/Request or Zend_Http_Client would be better
finally, there is installation instructions right there in the page

davey….you are talking way over my little head

file_get_contents("http://url") == HTTP stream - automatically just works
if you are wanting to pretend to post forms or whatever, http
blech

yeah !! thats ut
it

http://pear.php.net/package/HTTP_Client or download the Zend Framework http://framework.zend.com and pick out the Zend_Http_Client

me ?

yes, you

oh god….i'm scared

if you want to post forms or perform more than basic requests, use those
well, you're in luck, I wrote the base of the Zend one, heh
http://framework.zend.com/manual/en/zend.http.html#zend.http.client
it's pretty well documented

how ?

how?
I hit the keys on my keyboard

yes, how?

letters were typed

and then

or am I misunderstanding your question

sorry….just amazes me

HTTP is a pretty basic protocol

hold me

are you hot? :P

don't worry i am a girl

I didn't ask that

so its ok if i was a hot guy

Who am I to be picky?

man you men arent picky anymore, are you
whatever walks …grab it

if someone is hot, they're hot. regardless of gender. The fact is I find very men hot :P
very FEW men

but you do find some hot ?

sure

hello
what is PHP

depends who you ask

Personal Home Page.

don't make me stab you.

i am logging stuff to a file…

Yes, everyone on IRC does that [domon].

but it's *most* common answer is, a programming language commonly used for web sites (in fact, the most popular for that job

characters?

are you going to be a little more constructive?
[domon]: str_replace()

yuck lol

[domon]: pass in arrays for both the first two args
it's fast
[domon]: the other option is http://php.net/html_entity_decode

i think that's better
thx davey

[domon]: but it's pretty much the same thing under the hood
[domon]: str_replace() is faster if ALL you want is and

html_entity_decode replaces more than and .
Things like — and & will probably get replaced as well.

it's also character set aware

:P

if I have a mysqldump/phpmyadmin dump.. is there some how to easily excute it again through PHP?

yes and no

Wrong parameter count for fread() in /var/www/vhosts/iptriple.com/httpdocs/API/index.php on line 720
Wrong parameter count for str_replace() in /var/www/vhosts/iptriple.com/httpdocs/API/index.php on line 722
:|

if you have MySQLi then yes, it's reasonably easy

oh whoops
LOL

just use mysqli_multi_query()
otherwise, you need to explode() it into seperate queries, and iterate them through your query function of choice

hi. i am trying to understand the code here: http://pastebin.ca/636773. I know that it relates to the mapping of URLS within the site I am looking at. The main bit I'm unsure about is $GLOBALS['app']-Map-Connect. I am used to OOP syntax like
$this-class-method. Can anyone shed any light on this?

$GLOBALS['app'] is just the $app var in the global scope
$GLOBALS['app'] is an object, which has a property called Map, which is also an object, which has a property called Connect

okay, thanks

Davey, thanks. is this php4? I am used to php5 oop syntax. DO you mean an object as in an instance of a class?

welcome
it's PHP 4 and 5
and yes

I have a requirement to add the ability for users to be able to save a partially filled form, and allow them to resume filling it out later
anyone have any experience developng such a feature?

Davey, is there a general term/phrase for what the developer is doing here so that I can read up on it?

actually, I spotted one the other day, one minute
http://jan.prima.de/LiveSaver/

wow, that is great
thanks @Davey
I was considering using a button, and a table with form id:value in order to save
but, this is more "resilient"

$fp = fopen("iptlogfile.txt", "w+");
$data = fread($fp, "706220");
what's wrong with that? o.O

[domon]: assuming $fp != false, nothing

Davey, i'm guessing that the app object has been instantiated somewhere earlier in the code and is stored in a global variable. I'm not used to working that way but would be interested to find out more

it's nothing special; you understand scopes?

Davey, variable scopes, yes. As in local variables and global variables. I probably don;t understand the intracacies of them across all versions of php, though.

http://pastie.textmate.org/83002
Resource id #16
1

hasn't changed since PHP 4.1.2
well, even then the scopes didn't change, they just added superglobals

that's the output of the script o.O

[domon]: php.net/resources (IIRC)
$GLOBALS is a superglobal that is an array of variables in the global scope

Why does 10%3 give 1, but 3%10 gives 3? Shouldn't they both be 1? Where did the 3 come from?

% = remainder after division using whole numbers

it prints out 1 for is_resource

so 10 / 3 = 3 remainder 1, 3 / 10 = 0 remainder 3
because 3 is not divisible by 10

Oh, I see.
Thanks, Davey.

grr, 3rd blackout

ouch

UPS ftw!
no problem

anyone have any ideas?

Davey, I have heard people say that globals are bad. Why would you not just extend the base App class? Might this be to ensure that the script works on php4 and 5?

well, i didn't say the code was *great*, they should've used a singleton IMO

singleton? :| ?

its a design pattern

[domon]: one of the staples of design patterns

vaguely remembers it being talked about but can't remember exactly what it is
erm..
that was meant to have /me in front of it

http://www.phppatterns.com/docs/design/singleton_pattern

ty
anyone know wtf is going on with my script?

TML?

Davey, the code is from a cms/framework called Jaws. ever heard of it?

ugh, this is *old*
yes, and know people who work on it

TML? davey said you were a moron

Davey, ah cool. what do you think of it?

kidding

http://www.fluffycat.com/PHP-Design-Patterns/Singleton/ - better

Davey, I am interested in getting involved and maybe helping with the documentation (there is none)

never worked with it, but I know the guy I'm thinking is a decent code
a decent coder*
I think you'll find I said TML knew me when *I* was a moron :P

lol
i have to make myself laugh sometimes

Davey, is he a native english speaker. I always seem to get a non-native in #jaws

no, he's icelandic, but his english is great
helgi thormar (where the th is a weird char like |D)

Davey - cool I'll look out for him. THanks for your help and general wisdom!
bDavey - cool I'll look out for him. THanks for your help and general wisdom!/b

makes me worry for the human race, frankl
y

its all relative!

I am by no stretch of the imagination, wise.
I'm just a good actor

does anyone here know a good PHP gallery?

coppermine?

is preg_match a good thing to use for all my validations

http://coppermine-gallery.net/

only if you want to make complex patterns
*always* use native string functions if you can, like ctype_*, is_numeric, etc
regex is *slooow*

Well, i am using is_string to validate a firstname box
But doesnt that mean they can put in whatever they want, spaces, $, %

sup!

I checked out php.net/is_string and they tell you how to use stuff, but never say what it excludes

yes, try using ctype_alpha instead

For example Davey, does ctype_alpha exclude spaces

yes
maybe you want ctype_printable
(IIRC)

Ok, looks like i have a winner, thank you

Then that would still allow spaces, $, %.

How can I see what pear libraries I have installed?

pear list
from the command line

Hm, weird. I installed the progressbar extension, and I don't see it there. Maybe I'm looking for something else.

pecl extension?
pecl list

gah, yeah, it was pecl
Thanks, I'm a tad rusty

Yeah I've been using coppermine
But I don't know crap about php so when I really want to customize
it's near impossible for me

pear list -c pecl or some such would work too

gets frustrating

you're going to run with that with most thing
s

yeah
I should probably learn PHP
on a scale from extremely difficult to impossible
how hard is it

uhh

because it seems real hard

it's relatively easy

any advice on where to start?

get the visual book on php
(PHP published by Visual)

hm, okay, maybe it wasn't pecl. Or maybe it was installed by hand, and that's why it wasn't on the list (eg. from source).
require_once() [a href='function.require'function.require/a]: Failed opening required 'DB.php' (include_path='.:/usr/share/php') - that's the error, hm, I know it's pear, I think. /me googles

ok

php config-show
make sure the php_dir is set to /usr/share/php

does anyone here have any experience with coppermine?

http://pastie.textmate.org/83005 - what's wrong with that?

Hm, php config-show says Could not open input file: config-show. And where is php_dir set? I don't see it in php.ini. hmph

Could PHP be used so that, if I were to choose an item from a drop down box, it writes a table depending on what I selected?
Would I have to write the HTML using PHP?

sorry, pear config-show

why couldn't you do that?

oh, hehe

I'm not sure how I could accomplish it
PHP can't write into an HTML page that's already there, if I am not mistaken?

1) Formulate the problem 2) think hard 3) code solution

print "table$variable/table"; or….

Hm, yup, php_dir is /usr/share/php. I'm moving stuff from one server to another, and I forget what DB.php is.

No, PHP is a server-side language and HTML is static.

print "table" . $variable . "/table";

You can always use EMCAscript.

hey who can put PHP programming into a nutshell for me

you can use AJAX too

[domon]: I would but I don't really know any Javascript. D:

google xajax
you dont need to know a drop of JS
all done in PHP

Hmm. This looks interesting. I'm assuming, since it's PHP, I can use it with MySQL also?

PHP is a programming language, commonly seen with web frameworks. End.

yup

My PHP-based system now uses MySQL, that's where it gets the data for the HTML Table from

If you have mysqld running and PHP is built with MySQL support, yes.

yeah not really what i was looking for
cool though

http://pastie.textmate.org/83005 - what's wrong with that? T_T

hrpmh, what function i need to cleanup text retreived from database, that has " and ' in it that i need to echo thru html
tried addslashes, not work, i forget what's out there

grr, apache creates a directory, then can't delete it, permissions are 0777

why is apache creating a directory?

a directory for an ftp user

what is ownership of directory created?

Apache

what is group?

it has all permissions set
windows doesnt have groups
well, not in the same sense

are you sure its apache creatign the directory?
never knew it too have such a feature, but i never use it on windows either

pretty sure
the owner is apache, and it's created the same time i run the script
hmm, something weird is going on D:

print filesize("/var/www/vhosts/iptriple.com/httpdocs/API/iptlogfile.txt");
returns 0 everytime :|
tho the file does exist…

sounds more like a problem with windows than apache, i'll try afew more things

http://thatvideosite.com/video/4607

this script is php you talk about ?

well this is a php channel

solution, dont run apache on windoze :P

well php is creating the dir?

maybe i'll just go back to running apache as SYSTEM

as user apache

php runs under apache

safe mode?

no safe mode
unlink(CFTP\root\home\test) [function.unlink]: Permission denied in Dwww\dev\admin\ftp\user.php on line 43
i'll try delete it manually as the apache user

can someone help me really quick

tag

PHP has a function for this, $text = nl2br($text) to convert newlines to BR tags
so echo nl2br(file_get_contents($blah)); would work

i did that but now the text do show up

why not just use \n for newlines?

\n is fine for console
if printing to browser, \n !=

well this is what i have

yeah

php $text = nl2br($text);
echo nl2br(file_get_contents($news.txt)); ?

which is the whole point in conversion

permission denied

\n?

tags in where the newlines are, which could change how your site looks

it can write files into it but can't chdir into it

php echo nl2br($text); ?

TehSausage, i think you need to start conversation from scratch, sound like theory… why is script making directories as apache and not as user running script?

it's just a simple script to add/delete ftp users

is there a php-suexec or whatever?
for windows

okay apache user can delete from bash

cuz apache is deleting it, sounds like user is trying to delete which is why denied

have to use file_get_contents or else the content in the file wont disply on screen
have to use file_get_contents or else the content in the file wont disply on screen

file_get_contents = file into string
file = array

php echo nl2br(file_get_contents('somefile.txt')); ?

can someone tell me why print filesize("myfile") returns 0? the file is 777 for permissions, and definitely exists, as i can see it via FTP and shell

is the file bigger than that? rofl :P

because = the result
0 = the result

erm..?

[domon]: Well, what is the actual size of the file?

690 KB
706,220 bytes

oh joy, is_writable('C\FTP\\root\\home\\'.$user) returns true aswell

it worked thanks

anyone?

[domon]: You can try if (file_exists($filename)) print filesize($filename); else print "File doesn't exist?\n";

it exists

that way you can make sure you're referring to the file you think you're referring to… we don't know where this file is (same dir as the script? somewhere else?)

har har
found the problem

i think you have to take out \n

i had fopen(filem, w+) before print filesize(file) XD

hiddenfellon, why would he need to take out \n ?

hi

let's see if I can figure this out

how can i make a string always to be 10 digits? i tried all - $tmp = sprintf("%-' .10s", doesnt work

hello

use substr($string,0,10)
so $string = substr($string,0,10);
that will make it 10 digits

and this retuerns also 10 digits if the string has only 5?

well, no
then it would be 5

thats my problem

strpad

then just add some stuff onto it

I'm trying to figure out how to read data from a database using this

I want useing the javascript source.

strpad(substr($x,0,10),10,'0',STR_PAD_LEFT);

how can i do it?

thx

$row = mysql_fetch_array($query); this array value $row .. how can I using the javascript var i=[]; ?
db query and var a=[]; a==$row?; alert(a);
function Array() { [native code] }

you cannot do that
JavaScript and PHP have nothing to do with each other.
You need to loop through the results in PHP first, and assign them in JS during loop

Artnez, okay.. I know loop .. but it's very long line.. :-)

example - php echo "var results = new Array();\n" for( $i=0; $isizeof( $results ); $i++ ) { $result = $results[$i]; echo "results.push( '$result[name]', '$result[address]', '$result[other_field]' );";

so I will find better skill ^^;

in any case, you can't share variables between PHP and JavaScript, please read the basics of these 2 languages to understand why.

Artnez, thanks.. :-)
good man..

does anybody where i can get fonts fot FPDF?

Yes. Offtopic.

Jafet, can you tell me where?

I don't know.

Jafet, You said Yes!?

what does that have to do with PHP?

You asked if anybody knew. Somebody probably knows, so the answer is yes.

Artnez, yes . the class is written in PHP

Ask an inappropriate question…
If I write a PHP script to serve fetish hardcore gayporn, does that make fetish hardcore gayporn a valid topic of discussion in this channel?

Jafet, do you think you are "cool"? i don't think so

Yes, I think certainly think highly of myself. I don't see how that has anything to do with this, though.

I think he's cool too!

damike, google probably knows

He's convinced me too

stay on topic here please, do some googling

He seems pretty cool to me.

Jafet, here are PHP developers - i don't say the problem to ask such a question - just idioits complain about that!
see

In English please?

lol

Jafet, the last part is enough for you

?

And here he comes, straight into the troll-trap, folks!

damike - ASL?

just to questions about *php code* and you'll be fine

Artnez, …

google search for "fpdf fonts", could you know have done that?
the first result is what you need
you'd have all of your fonts ready by now if you spent that time google searching

Artnez, i still tried to convert manually

whatever, just use google. i believe this channel is to help people learn PHP better, not how to operate proprietary librarys that convert font files to PHP files

"The award-winning Opera Web browser The coolest, fastest, and most secure Web browser available." - those are rather bold claims =/

hello

ShaunOo`: Bold… but true!
Firefox doesn't count because it's an XUL interpreter, not a web browser.

Artnez, no problem so far - but at the moment there a no people here asking PHP questions - so i can't understand why IRC people have problems with that - the "my holy channel" thinking .oO

you are ignored. im not an admin, talk to them :-/

I'm sure there are lots of user in this channel who know where to find fetish gayporn as well. That does not make it appropriate to ask for fetish gayporn in this channel.
s/user/users/

ShaunOo`: Opera is great. Only problem that I have is it doesn't have a lot of community plugins like FF.

which functions can i use to list in a web page the last 5 files that have been modified or added inside a directory ?

ShaunOo`: IE: the web developer plugin sucks, whereas the one for firefox is great

http://xkcd.com/293

Artnez, ahh. IE and Opera - where is the PHP part? …
troll channcel

#phpc

:p
funny pic
anyways

All the functions needed should be neatly categorized in the manual.

do you know them

you were talking about FireFox?

Check under Filesystem and Directory, or something.

k thanks

No, I don't. I do know where to find them.

My Name is Blah My Name is Halb, how do you make it some preg_replace only replaces between the first ocurrence of My Name?
so*

To throw damike off. Nevermind.

use the filemtime() function

is it recursive ?

Generally preg_replace will find the first occurence My and the last occurence of Name
Can you set it to non-recursive?

um, no. you need to specify the filename as a parameter.

No LongBeach. You have to traverse directories yourself.

just loop through the dir and sort

ok, i hope it's fast

If it isn't, don't use PHP.

nah, traversing recursively through a large directory tree is not fast in any way, php or not

PCRE regex isn't recursive by default, if I understand what you're asking that is…

Doesn't preg_replace only replace the first occurence unless you use the global flag…

I want to replace the first My Name not what's in between…

it would help to use special naming conventions for the filenames

I am not sure guys

http://www.the-art-of-web.com/php/dirlist/

tell us the original text and the way you want it to be
can't guess what you want

"My name Chad"

preg_replace('/My name/', ''); ?

"My name is Bob My name Chad", it's already null thankfully.

Artnez, I prefer Opera for PocketPC but not for desktop for some reason *shrug* but regardless, it's THE best mobile browser.
Hell, even IE for mobile is better than Minimo :P

preg_replace doesn't look at the first occurence and stop, it looks at the end of the string and then replaces..

so you want to remove the "is"
is it *always* "is", or can it be something else?

What's your expression?

Well the REAL string is:
"SELECT [….] FROM WHERE ( SELECT FROM […] WHERE [….] )" and I want to replace the FIRST occurence of SELECT FROM and place something like count(*) inbetween it. only the first occurence.

are you trying get total results for DB query?

yes
I have a bunch of union'd statements

there is a better way

So I have make them sub-queries
What's the better way? I haven't see any other way to do it…
heh

SQL_CALC_FOUND_ROWS

Use a non-greedy match.

http://www.arraystudio.com/as-workshop/mysql-get-total-number-of-rows-when-using-limit.html

Or that.

sorry, i had to google it. couldn't remember the exact thing

Interesting, I'll try it.

read the MySQL docs on the topic here: http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_found-rows
note what they say about unions
will probably be relevant to your situation

Interesting, thank you so much for that Artnez, that helped me immensely.
No preg_match needed =D

$var, $_POST['var'], $HTTP_POST_VARS['var']

i think im going to buy a hat tomorrow so i can really tip it, thats such a smooth thing to do
use $_POST

ok. just out of curiosity is there a reason why everyone doesn't just use the shortest version?

learn the difference between superglobals, read up here:

http://bin.cakephp.org/view/851322774

http://php.net/manual/en/language.variables.predefined.php#language.variables.superglobals

alright thx

please dont forget to read up on
*register_globals*

well i'm reading a book right now. just haven't gotten to superglobals and stuff yet

how old is the book?

$arr[0][0]['count'] ?

2005. it talks about php5

oh…

but thats the newest

hey
how do you calculate sysdate minus 2 weeks ?

arg the websites talking about php6. i wish technology would pause for a moment sometimes :P

go back to kernel 2.2 then

ha

Thanks Artnez again, that really saved me A LOT of time and actually improved a lot of things

or go back to Rasmus Ledorf's mother womb

cool

Can somebody say 'unbirthing' … ew ..nothing could be more worse

uhh wtf lol

what do you guys think of MVC?

it will save your life
just dont use somebody elses code to do it

what do you mean? not use a lib?
or an MVC framework, rather
im thinking of using CodeIgniter

yeah. Look at how frameworks work, and learn from them, and create your own to suit your needs

well, i did, but it doesnt use MVC
and i'm doing just fine with it

it all depends on what you want your site to do

it actually acts alot like MVC does, except with Models and the file structure is slightly different

if your site has a 'one-look-and-feel' based system, MVCing is going to be a big timesaver
aaah… MVC = Model View Controller
so 'except with models' == wtf?

*without, sorry

oh :P
imo, file structure is unimportant
its how the code is assembled that counts
nasty = include trees

yes, i avoided this well

include("bigincluderfile.php") ?
ive worked on so much code that includes more than nessecary to make a page work, and its hell trying to work out what exactly it does

yes, i dont do that at all. there's only one place where includes come from and that's the main.php file (which is the starting point)

imo, the MVC philosophy basically equates to keeping the problem domain in the one place

i guess i'll stick with my framework, it's been working great for half a year with no problems
was just second guessing myself as i always do to try and better myself :]

yeah, if it works good, and development is fast, i say dont change unless you _know_ something else will work better ^_^

ha, i need to take a week or two break so i can pull my code together and make it rapidly deployable (ie; create an SQL schema and refine it, maybe an installer files)

my biggest task atm is modularisation for easy slap in from one site to the next

i actually just finishe that upgrade

my MVC aint perfect yet,

at the moment the framework comes with MySQL database handler, data objects, session handling, etc
in the config, you set the libraries you want to load
some are dependant on one another, so errors are raised appropriately

why raise errors? why not just be smart and include what you need?

the biggest gotchas i keep having where there are modular interactions, but the interactions are always different depending on the