php-general Digest 21 Feb 2006 13:31:49 -0000 Issue 3976
Topics (messages 230778 through 230801):
Re: Different Values for intval(float)
230778 by: Chris
Re: Distribution of records
230779 by: Chris
Re: regular pattern to match XXX
230780 by: Chris
question about foreach and associate array
230781 by: jonathan
230782 by: Chris
230785 by: Peter Lauri
230794 by: Jochem Maas
Re: Request for views on ASP/PHP/ASP.NET - please!
230783 by: Rafael
230796 by: Simon O'Beirne
Re: Working with a config file
230784 by: Paul Scott
HOSTNAME Environment variable
230786 by: Ruben Rubio Rey
230788 by: Kim Christensen
230791 by: Ruben Rubio Rey
230792 by: Kim Christensen
Re: php+ ajax
230787 by: Kim Christensen
230793 by: Jochem Maas
230795 by: Kim Christensen
230797 by: David Dorward
Re: JPG Compression [detached thread]
230789 by: Kim Christensen
¹©Ó¦É̹ÜÀíÓë²É¹º³É±¾¼¼ÇɿγÌ
230790 by: Ï£ÈñÆóÒµ¹ÜÀíÅàѵ
Help with query
230798 by: Ing. Tomás Liendo
230799 by: Barry
Re: Problem with Square Brackets [was: php+ ajax]
230800 by: Jochem Maas
Re: newbie problem
230801 by: Jay Blanchard
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
php-general@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
Interestingly enough, I tried it on several of my machines, which are
different platforms and different (sub)versions of PHP and I got
different results:
RH7.3 with PHP 4.1.2: 2113879380
IRIX 6.5.11 with PHP 4.2.3: 2147483647
FC1 with PHP 4.3.6: 2113879380
RH7.3 with PHP 4.3.9: 2113879380
FC3 with PHP 4.3.10: -2147483648
FC4 with PHP 4.4.0: -2147483648
FC4 with PHP 5.0.5: -2147483648
So my question now, is it version or platform related?
I'd guess it depends on the compiler on the machine and (maybe) the libc
version. Probably best to ask on the developer list about it.
--- End Message ---
--- Begin Message ---
Hi Alan,
Formation
OCall
DCall
OYards
Key
The key is an amalgam of the first 3 fields so a typical record might
look like this:-
Formation - I
OCall - RT
DCall - BZ
OYards - 5
Key - IRTBZ
What I want to do is to produce report that looks like this:-
Form
OCall
DCall
OYards - Median
OYards - Mean
OYards < 0
OYards 0 - 4
OYards 5+
So in other words for every combination of Formation, OCall and DCall I
want to report how many times it occured, what the Median and Mean
values were and what the distribution of plays was.
I reckon I'm going to have to create an array and then loop over the
array pulling out the relevant information but are there any special
techniques I should consider?
You should be able to do this all in sql.
Something like:
select formation, count(formation) AS timesrun, ocall, dcall,
AVG(oyards) FROM table GROUP BY formation, ocall, dcall;
--- End Message ---
--- Begin Message ---
Satyam wrote:
----- Original Message ----- From: "Patrick" <[EMAIL PROTECTED]>
im trying to get my regular pattern to allow åäöÅÄÖ but it refuses to,
i have something like this:
[^a-zA-ZåäöÅÄÖ0-9-_ ]
But this dosent seem to work, anyone got any ideas?
Just an idea, try putting a backslash before the non-ASCII characters,
perhaps that will force the function to take them literally instead of
making who knows what assumption about them. And let me know if it
works because we use diacritical marks in Spanish, who know when I might
need it.
Satyam
Are these characters multibyte? You might need to use the mb_ereg_match
function rather than the regular ereg functions:
http://www.php.net/manual/en/function.mb-ereg-match.php
--- End Message ---
--- Begin Message ---
I have the following construct:
$arg['textarea']['body']="Hello";
foreach($arg['textarea'] as $row)
{
echo $row['body']."<br/>";
echo $arg['textarea']['body']."<br/>";
}
I would expect both of them to output "Hello" but only the second
does. The first outputs "H". I thought I have done this before. Can
anybody tell me why this won't work?
thanks,
jonathan
--- End Message ---
--- Begin Message ---
jonathan wrote:
I have the following construct:
$arg['textarea']['body']="Hello";
foreach($arg['textarea'] as $row)
{
echo $row['body']."<br/>";
echo $arg['textarea']['body']."<br/>";
}
I would expect both of them to output "Hello" but only the second does.
The first outputs "H". I thought I have done this before. Can anybody
tell me why this won't work?
You have an associative array so you need to specify both parts:
foreach($arg['textarea'] as $area => $entry) {
echo $area . '<br/>'; // body
echo $entry . '<br/>'; // hello
}
Your method works ok for indexed arrays like:
$array[1] = "XYZ";
$array[2] = "ABC";
etc
--- End Message ---
--- Begin Message ---
Just do:
$arg['textarea']['body']="Hello";
foreach($arg['textarea'] as $row) {
echo $row."<br/>";
echo $arg['textarea']['body']."<br/>";
}
The $row is an string, and what you are trying to do the $row['body']. And
php will translate 'body' to 0 in this, I do not know why :)
Try
echo $row['body']. $row[1]. $row[1]. $row[2]. $row[3]. $row[4];
It will probably echo Hello for you :)
/Peter
-----Original Message-----
From: jonathan [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 21, 2006 9:58 AM
To: php-general@lists.php.net
Subject: [PHP] question about foreach and associate array
I have the following construct:
$arg['textarea']['body']="Hello";
foreach($arg['textarea'] as $row)
{
echo $row['body']."<br/>";
echo $arg['textarea']['body']."<br/>";
}
I would expect both of them to output "Hello" but only the second
does. The first outputs "H". I thought I have done this before. Can
anybody tell me why this won't work?
thanks,
jonathan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
jonathan wrote:
I have the following construct:
$arg['textarea']['body']="Hello";
foreach($arg['textarea'] as $row)
{
echo $row['body']."<br/>";
$row contains the _string_ 'Hello'.
the thing is you can use array-like notation to
get at the individual chars of a string....e.g:
echo $row[0]; // outputs an 'H'
when you try to grab the char at index position 'body'
in the string 'Hello' the string 'body' is first converted to
an integer to determine what the char offset is. i.e.
echo (int)"body";
echo $arg['textarea']['body']."<br/>";
}
I would expect both of them to output "Hello" but only the second does.
The first outputs "H". I thought I have done this before. Can anybody
tell me why this won't work?
thanks,
jonathan
--- End Message ---
--- Begin Message ---
Well, I would like to know what conclusion you got, so if possible let
me know when you have enough data/finished you work.
Simon O'Beirne wrote:
Hi guys,
A bit of an odd request. I'm in my third and final year at university, and
part of an assignment requires obtaining developers' perspective on web
languages.
If anyone has done at least one of the languages in the subject title
(ASP/ASP.NET/PHP), I would be eternally grateful if you could pop to (and
also send any other web developers you know to)
http://www.coralsystemsolutions.co.uk/uni
Theres a maximum of 14 short questions (depending on answers to the other
questions), all optional, just fill out as much as you can be bothered with,
then click submit a few times until its saved.
Thank you very much in advance!
Simon
--
Atentamente,
J. Rafael Salazar Magaña
Innox - Innovación Inteligente
Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE
[EMAIL PROTECTED]
http://www.innox.com.mx
--- End Message ---
--- Begin Message ---
Gladly :) Due to be finished at the end of march, however results will be
analysed start/mid march. Will keep you informed!
Simon
"Rafael" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Well, I would like to know what conclusion you got, so if possible let
me know when you have enough data/finished you work.
Simon O'Beirne wrote:
> Hi guys,
>
> A bit of an odd request. I'm in my third and final year at university,
> and
> part of an assignment requires obtaining developers' perspective on web
> languages.
>
> If anyone has done at least one of the languages in the subject title
> (ASP/ASP.NET/PHP), I would be eternally grateful if you could pop to (and
> also send any other web developers you know to)
>
> http://www.coralsystemsolutions.co.uk/uni
>
> Theres a maximum of 14 short questions (depending on answers to the other
> questions), all optional, just fill out as much as you can be bothered
> with,
> then click submit a few times until its saved.
>
> Thank you very much in advance!
>
> Simon
--
Atentamente,
J. Rafael Salazar Magaña
Innox - Innovación Inteligente
Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE
[EMAIL PROTECTED]
http://www.innox.com.mx
--- End Message ---
--- Begin Message ---
On Tue, 2006-02-21 at 00:14 +0100, Jens Kleikamp wrote:
> Benjamin Adams wrote:
> > I'm trying to parse a config file, example of the config is:
> > [fred]
> > id=8782
> > section=s1
> > years=4
> > download1=mirror1
> >
> > [frank]
> > id=8372
> > section=s3
> > years=4
> > download1=mirror12
> > download2=mirror2
> > .
Config files of this type in PHP anyway, are generally generated by the
PEAR Config package. Luckily for you it works both ways (creating and
reading the files) so its really easy to work with. The Config package
also supports all sorts of nifty features that will make your life
easier working with this file.
HTH
--Paul
--- End Message ---
--- Begin Message ---
Hi,
How to set "Hostname" environment variable? (It contains the servers
name, not the servers domain)
Its a Linux server.
Thanks in advance.
--- End Message ---
--- Begin Message ---
On 2/21/06, Ruben Rubio Rey <[EMAIL PROTECTED]> wrote:
> How to set "Hostname" environment variable? (It contains the servers
> name, not the servers domain)
> Its a Linux server.
Try the "hostname" command. Depending on your linux distro, you might
want to edit /etc/hostname manually afterwards to double-check.
--
Kim Christensen
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Kim Christensen wrote:
On 2/21/06, Ruben Rubio Rey <[EMAIL PROTECTED]> wrote:
How to set "Hostname" environment variable? (It contains the servers
name, not the servers domain)
Its a Linux server.
Try the "hostname" command. Depending on your linux distro, you might
want to edit /etc/hostname manually afterwards to double-check.
--
Kim Christensen
[EMAIL PROTECTED]
Strange. Its already set (in hostname and "echo $HOSTNAME"). I have
realized that is working on version (in my servers) 5.0.5 and its not
working in 5.0.4 version. Is it an old bug? Im updating, we ll see ....
--- End Message ---
--- Begin Message ---
On 2/21/06, Ruben Rubio Rey <[EMAIL PROTECTED]> wrote:
> Strange. Its already set (in hostname and "echo $HOSTNAME"). I have
> realized that is working on version (in my servers) 5.0.5 and its not
> working in 5.0.4 version. Is it an old bug? Im updating, we ll see ....
Have you rebooted your machine since you changed the hostname? I don't
know where PHP/Apache gets the hostname variable from - there are
quite a few places where that variable is stored on a linux system -
but most services reads the /etc/hostname file upon boot, therefor the
need for a restart after changing it.
You might want to check the contents of /proc/sys/kernel/hostname, and
even changing it by issuing:
echo your_hostname > /proc/sys/kernel/hostname
If it still doesn't work, reboot to be sure.
--
Kim Christensen
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
On 2/20/06, David Dorward <[EMAIL PROTECTED]> wrote:
> Element ids may not contain square brackets in HTML documents.
Get your facts straight, David. Square brackets works fine in HTML
documents as long as you escape the ID when you need to reference them
by JS.
--
Kim Christensen
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Kim Christensen wrote:
On 2/20/06, David Dorward <[EMAIL PROTECTED]> wrote:
Element ids may not contain square brackets in HTML documents.
Get your facts straight, David. Square brackets works fine in HTML
David has his facts straight, just because something works (for you)
doesn't make it correct (MARQUEE tag anyone?):
<quote from="http://www.w3.org/TR/html4/types.html#type-name">
ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed
by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"),
colons (":"), and periods (".").
</quote>
what I do usually is misuse the square brackets in the name - to get
the arrays in php - and use a different string for the id (one that is
technically) valid for use in javascript.
Kim do the escaped sqaure brackets work in all majors browsers as
far as you know?
documents as long as you escape the ID when you need to reference them
by JS.
--
Kim Christensen
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
On 2/21/06, Jochem Maas <[EMAIL PROTECTED]> wrote:
> Kim do the escaped sqaure brackets work in all majors browsers as
> far as you know?
"Major browsers" as in Firefox and IE for PC/Mac works great, yes -
haven't had the chance to try Opera or Konqueror yet, maybe someone
could shed a light on this?
Sorry for being rude, David - had a bad morning!
--
Kim Christensen
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
--- Kim Christensen <[EMAIL PROTECTED]> wrote:
> On 2/21/06, Jochem Maas <[EMAIL PROTECTED]>
> wrote:
>> Kim do the escaped sqaure brackets work in
>> all majors browsers as far as you know?
> "Major browsers" as in Firefox and IE for PC/Mac
> works great, yes -
Many browsers are amazing at being able to compensate
by errors made by authors, but that shouldn't be taken
as an excuse to not treat the errors as anything other
than something that should be fixed.
You can't test in every browser out there - there are
too many. You can't test in any browser that hasn't be
written yet.
Writing code that ignores the standards is just asking
for maintainance headaches and other troubles down the
line.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--- End Message ---
--- Begin Message ---
Julian, remember to send a new message when posting a thread for the
first time, instead of replying to an old one. I'm sure it was a
mistake, but most people won't bother to answer these kind of posts.
On 2/20/06, julian haffegee <[EMAIL PROTECTED]> wrote:
> Is there a php function that lets you compress the jpg?
http://php.net/manual/en/function.imagejpeg.php
--
Kim Christensen
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
+++++++++++++++供应商管理与采购成本降低技巧培训++++++++++++++++++
----------------------------------------------------------------------
2006年3月4-5日 上海青年培训活动中心
----------------------------------------------------------------------
举办++希锐企业管理咨询公司
费用++1800元/人[提供讲义、午餐、发票等](三人以上九折优惠)
咨询报名 :0755-83524370 曾小姐 欢迎您的来电咨询!
传真:0755-83524349
----------------------------------------------------------------------
课程背景:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++?
"成本"是采购人员心里"永远的痛",采购人员每年在做降价工作,但企业为
了控制库存,采购周期越来越短、采购批量越来越小,供应商怨声载道,加上原
材料的价格不断上涨,降价的工作越来越富有挑战。 通过对本课程的学习,学员
可以了解现代采购管
理的发展趋势,改善企业的采购组织以及采购流程的设定,完善供应商管理体系,
提升采购谈判能力。从而帮助采购人员选择最佳供应商和采购策略,确保采购工
作高质量、高效率及低成本执行,使企业具有最佳的供货状态,同时与供应商保
持良好的战略伙伴关系。
----------------------------------------------------------------------
导师简介
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
马老师,德国汉堡大学供应链管理博士,复旦大学管理学博士, 上海海事大
学教授(即上海海运学院),注册培训师,美国AITA授权国际职业顾问,美国国
家采购管理协会会员(NAPM),深圳希锐企业管理公司高级顾问师。长期从事物
流与采购分析研究工作,并兼任德国拜耳公司中国采购帮办,尤其擅长建立现代
企业物流管理系统与采购管理工作流程及供应链模型。常赴德国、美国、日本等
交流培训经验。著作有《物流人才浅论》、《企业信息化的实施准则》、《第三
方物流管理的集与散》、《供应链管理的误区》、《JIT系统》等。
曾经讲授及辅导过的企业有:松下电器、IBM、蒲金钢板(韩)、富士工具(
日)、日立(HITACHI)、汤姆逊(THOMSON)、埃尔夫(EIF)、飞利浦、三洋、
诺基亚、西门子 、华凌空调、美的空调、立白集团、百事可乐、四川长虹集团等
三百多家企业。马先生专精于采购与企业运营系统改善、供应链、物流控制、MRP
/ERP,TQM、生产控制与价值工程等。
马老师具有扎实深厚的理论与实务经验,授课生动、气氛活跃、贴近企业实战
要求、获得学员的一致好评。
-----------------------------------------------------------------------
课程大纲
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1、采购的新型理念
◆采购系统设计的指导思想
◆供应链系统的目标冲突
◆供应链系统的设计
2、采购核心价值与采购成本控制?
◆采购条款及与供应商关系策略?
◆采购流程的合理化设计?
◆采购中的成本影响因素分析?
◆如何降低采购成本?
◆供应商通常依据哪些要素进行报价?
◆三方报价与价格分析工具的制定?
◆如何分析供应商的价格市场定位与走向?
◆如何运用价格分析工具来分析报价?
◆工作流程及实施技巧?
◆价值分析/价值评价(VA/VE)
◆成本降低方案(Cost Down Program)
◆价格分析与控制
3、采购谈判技巧
◆谈判的步骤
◆如何掌握卖方真实的销售心理
◆利用买卖双方的优劣进行谈判
◆如何利用上级的权限进行议价
◆采购谈判技巧的“规则”
◆有效谈判应注意的事项
◆买方占优势时应采用何种采购策略
◆卖方占优势时应采用何种采购策略
4、供应商选择与管理
◆如何依据公司发展,销售目标制定供应商需求体系
◆供应商开发与认可程序
◆采购商业体系、质量体系的构建?
◆供应商选择与评价的考评因素?
◆供应商商业、服务、质量审核要素?
◆批量生产中供应商的日常管理?
◆供应商定期评估、等级划分与双赢模式建立?
◆案例分析?
5、如何管理供应商
◆建立对供应商管理之制度
◆供应商之交期管理(Delivery)
◆供应商品质管理(Quality)
◆供应商成本管理(Cost)
◆供应商服务管理(Service)
◆主要供应商管理
◆建立与策略性供应商的伙伴关系
◆如何管理单一供应商◆如何与供应商谈判
◆案例研讨:供应商管理
6、如何进行供应商绩效评估
◆建立供应商绩效考核标准
◆供应商绩效分析
◆如何进行供应商绩效评估
◆如何奖励供应商
◆如何淘汰不良供应商
◆如何协助供应商改善绩效
◆如何进行供应商发展
◆案例研讨
7、采购管理效能评估?
◆采购管理效能评估的方法
◆采购人员的绩效评估
◆杜绝无效的采购行为
8、大量综合案例分析
9、实际问题解答
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
报名回执表
我公司拟派员参加《供应商管理与采购成本降低技巧》培训班。
参加单位:________________________________________________
联系人:_______________;电话________________;传真__________
参加人:1______________;2________________;3________________
4______________;5________________;6________________
共_____人[需安排住宿: 是( ) 否( )]
提示:1 报名表填写完整并传真后,请务必再次电话确认,以确保报名成功;
2 我们收到传真后会有专人联系您。
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
--- End Message ---
--- Begin Message ---
Hi I need the students that didn't take an exam. The tables:
exams(id_test, title, desciption, ....)
results(id_student, id_test, date, qualification...)
I'm using a version of MySQL that doesn't support NOT IN, then I tried in
this way:
SELECT * FROM exams LEFT JOIN results ON exams.id_test=results.id_test WHERE
results.id_test IS NULL AND id_student=".$user
The query doesn't return anything... What Can I do???
Ahead of time, thank you very much,
Tom.
--- End Message ---
--- Begin Message ---
Ing. Tomás Liendo wrote:
Hi I need the students that didn't take an exam. The tables:
exams(id_test, title, desciption, ....)
results(id_student, id_test, date, qualification...)
I'm using a version of MySQL that doesn't support NOT IN, then I tried in
this way:
SELECT * FROM exams LEFT JOIN results ON exams.id_test=results.id_test WHERE
results.id_test IS NULL AND id_student=".$user
The query doesn't return anything... What Can I do???
Ahead of time, thank you very much,
Tom.
--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)
--- End Message ---
--- Begin Message ---
<SIDENOTE TO JAY>
add to your list of potential book topics?:
knowing when to successfully break the rules.
(i.e. when to not follow the standards)
</SIDENOTE TO JAY>
From a php developer point of view there is one
big problem with 'follow the standards' mantra as
far as square brackets go (with regard to use in the
value of name attributes of form fields) ...
namely if you following the standard you can't use
the array translation capability of php with regard to
incoming request variables.
here is a url from a CMS of mine:
/manager.php?e[n]=article&e[kf][ARTICLE_ID]=186&e[f][n]=bundles&e[f][kf][BUNDLE_ID]=12427&e[f][f][n]=bundledarts&e[f][f][kf][BUNDLE_ID]=12427&e[f][f][kf][BUNDLED_ID]=477&a=2
it's dynamically generated and uses a nested array structure
to describe a 'path' to whatever entity (or list of entities) is being
requested (list, edit, etc) -- it works, it's flexible and
I wouldn't have a clue where to start refactoring this so that
the square bracket 'magic' is no longer required.
David Dorward wrote:
--- Kim Christensen <[EMAIL PROTECTED]> wrote:
On 2/21/06, Jochem Maas <[EMAIL PROTECTED]>
wrote:
Kim do the escaped sqaure brackets work in
all majors browsers as far as you know?
"Major browsers" as in Firefox and IE for PC/Mac
works great, yes -
Many browsers are amazing at being able to compensate
by errors made by authors, but that shouldn't be taken
as an excuse to not treat the errors as anything other
than something that should be fixed.
You can't test in every browser out there - there are
too many. You can't test in any browser that hasn't be
written yet.
Writing code that ignores the standards is just asking
for maintainance headaches and other troubles down the
line.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--- End Message ---
--- Begin Message ---
[snip]
> [snip]
> When working with an HTML file with a form with
>
> <form action="somename.php" method="post">
>
> the somename.php file is served (completely) to my browser as plain
text
> after the 'submit' button is clicked on my machine (MacOS X). On the
> external webhost though everything is processed correctly...
>
> Is this related to some setting that I should change on my localhost?
> [/snip]
>
> Are you working on localhost or the remote server? Have you uploaded
the
> form to the remote server?
I tested them on both the localhost and - after uploading them - on the
remote server. The remote is ok, but the localhost (with PHP 5.1.2) is
the problem.
[/snip]
Have you installed PHP on the localhost and is it running properly?
--- End Message ---