[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

5.8

Missing STDIN.

Asked by RQuadling in DOS and Windows, Windows XP Operating System, PHP for Windows

Hi.

I've been looking into getting some PHP scripts to be usable as filters ... e.g.

dir | LineReverse

By using ASSOC and FTYPE at the command line to define what .php is and how it is executed, along with having the php.exe in PATH and .PHP in PATHEXT, the script executes, STDIN is always available, but STDIN becomes "blocking" and no output. (See http://docs.php.net/manual/en/install.windows.commandline.php for the documentation I'm working from and currently updating).


But ...

dir | c:\php5\php.exe LineReverse.php

works fine.



I'm hoping someone who knows the way in which windows shells work can answer this.


The registry settings for .php and phpfile are ...

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.php]
@="phpfile"
"Content Type"="application/php"

and

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\phpfile]
@="PHP script"
"EditFlags"=dword:00000000
"BrowserFlags"=dword:00000008
"AlwaysShowExt"=""

[HKEY_CLASSES_ROOT\phpfile\DefaultIcon]
@="C:\\PHP5\\php-win.exe,0"

[HKEY_CLASSES_ROOT\phpfile\shell]
@="Open"

[HKEY_CLASSES_ROOT\phpfile\shell\Open]
@="&Open"

[HKEY_CLASSES_ROOT\phpfile\shell\Open\command]
@="\"C:\\PHP5\\PHP.EXE\" \"%1\" %*"

[HKEY_CLASSES_ROOT\phpfile\shell\Open\ddeexec]

[HKEY_CLASSES_ROOT\phpfile\shell\Open\ddeexec\Application]
@="PHP"

[HKEY_CLASSES_ROOT\phpfile\shell\Open\ddeexec\Topic]
@="System"



I'm wondering if there are some additional options I can use here.

A daft example that works ...

dir Z:\*.txt | find /i ".txt" | php z:\filter.php  | sort /r

outputs ...

txt.thgir 229,44            90:21  22/50/9002
txt.tfel 360,34            90:21  22/50/9002
txt.stsnoc 186,55            94:01  30/70/9002
txt.sruoloC tpmorP ISNA ediW 238,74            12:31  12/40/9002
txt.sruoloC tpmorP ISNA 238,74            01:31  12/40/9002
txt.selif 265,083           63:61  42/60/9002
txt.secnereffid CCC dnuoF 802               22:31  13/70/9002
txt.secnereffiD CCC 495,11            61:01  40/80/9002
txt.reknirhS 589,8             11:21  42/30/9002
txt.QAR 72                31:31  10/10/9002
txt.pleh_DV 929,01            11:11  31/50/9002
txt.nomeliF laitraP 910,33            81:80  80/40/9002
txt.lrep-llatsni-lcep 371,34            00:61  03/40/9002
txt.liavAsrohtuAkcehC 478,12            04:01  01/80/9002
txt.knaB tnerruC - tropeR yrammuS noitaulaV knaB tinU 068,16            13:51  92/50/9002
txt.knaB tnerruC - tropeR yrammuS noitaulaV knaB gnilretS 499,02            13:51  92/50/9002
txt.ini 423,92            20:11  12/40/9002
txt.ilc-php 223,92            15:41  61/40/9002
txt.gubed 914,01            31:90  71/80/9002
txt.gol.nomeliF 263,621           13:80  20/40/9002
txt.ger 86                72:41  91/30/9002
txt.fo spukcab ekaM 151               82:41  81/30/9002
txt.ffid.sj.p 593,2             20:11  11/60/9002
txt.edoc 086,22            74:80  12/40/9002
txt.ataD lacinhceT etuhCrewoP 804               43:51  02/70/9002
txt.94fo3 021,29            65:51  40/80/9002
txt.2lrep-llatsni-lcep 181,221           00:61  03/40/9002
txt.2d 369,4             24:51  21/60/9002

dir Z:\*.txt | find /i ".txt" | z:\filter  | sort /r

executes (I can see this via Process Explorer), but nothing I have to CTRL+C to break the task.

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
<?php
while(!feof(STDIN)) {
	$s = fgets(STDIN);
	if (!is_null($s)) {
		fputs(STDOUT, strrev($s));
	} else {
		echo "Waiting to get something from STDIN.\r";
	}
}
?>
[+][-]09/08/09 04:53 AM, ID: 25280865Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: DOS and Windows, Windows XP Operating System, PHP for Windows
Sign Up Now!
Solution Provided By: RQuadling
Participating Experts: 0
Solution Grade: B
 
[+][-]09/08/09 10:43 AM, ID: 25284281Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625