Re: [PHP] Creating a File in Memory

2007-09-07 Thread Michael Preslar
Can't help with your main problem, however I find it easier to write
the likes of :

$kml_string = STOP
all of
the soap
maybe some water
some chips if you have them
STOP

On 9/7/07, John Schattel [EMAIL PROTECTED] wrote:
 Hello All,

 I am trying to zip data in a PHP program using the following code.  The
 resulting file (ndfdViaPipe.kmz) is zip'ed but the data in the archive
 lacks a file name.  So when a program like Google Earth tries to process
 the file, it fails.  When I bring ndfdViaPipe.kmz into WinZip, the file
 has no name but can otherwise be extracted just fine.  Once extracted,
 Google Earth can process the file.  Does anyone know how I might add the
 file name information to the ndfdViaPipe.kmz?  The reason I'm trying
 to use pipes is to avoid creating a file with the dynamically created
 data in $kml_string.  The plan is to send $kmz_content out in a SOAP
 service message with the payload as base64 encoded file.  If there is a
 better way to accomplish this I am certainly open to suggestions.

 In advance, thanks for any help you care to offer.

 John

 ?php

 $kml_string = ?xml version=\1.0\ encoding=\UTF-8\?;
 $kml_string = $kml_string . kml
 xmlns=\http://earth.google.com/kml/2.1\;;
 $kml_string = $kml_string . Document;
 $kml_string = $kml_string .nameNational Digital Forecast Database
 Data/name;
 $kml_string = $kml_string .open1/open;
 $kml_string = $kml_string .   Schema parent=\Placemark\
 name=\NdfdData\;
 $kml_string = $kml_string . SimpleField type=\wstring\
 name=\UOM\/SimpleField;
 $kml_string = $kml_string . SimpleField type=\wstring\
 name=\ValidTime\/SimpleField;
 $kml_string = $kml_string . SimpleField type=\int\
 name=\MaxTemp\/SimpleField;
 $kml_string = $kml_string .   /Schema;
 $kml_string = $kml_string .   NdfdData;
 $kml_string = $kml_string . nameMaximum Temperature/name;
 $kml_string = $kml_string . description90F valid at
 2007-06-26T00:00:00-04:00/description;
 $kml_string = $kml_string . Point;
 $kml_string = $kml_string .   coordinates-77.37,37.82/coordinates;
 $kml_string = $kml_string . /Point;
 $kml_string = $kml_string . UOMF/UOM;
 $kml_string = $kml_string . 
 ValidTime2007-06-26T00:00:00-04:00/ValidTime;
 $kml_string = $kml_string . MaxTemp95/MaxTemp;
 $kml_string = $kml_string .   /NdfdData;
 $kml_string = $kml_string .   NdfdData;
 $kml_string = $kml_string . nameMaximum Temperature/name;
 $kml_string = $kml_string . description89F valid at
 2007-06-26T00:00:00-04:00/description;
 $kml_string = $kml_string . Point;
 $kml_string = $kml_string .   coordinates-77.5,38.00/coordinates;
 $kml_string = $kml_string . /Point;
 $kml_string = $kml_string . UOMF/UOM;
 $kml_string = $kml_string . 
 ValidTime2007-06-26T00:00:00-04:00/ValidTime;
 $kml_string = $kml_string . MaxTemp89/MaxTemp;
 $kml_string = $kml_string .   /NdfdData;
 $kml_string = $kml_string . /Document;
 $kml_string = $kml_string . /kml;

 $descriptorAssignments = array(
0 = array(pipe, r),  // stdin is a pipe that the child will read
 from
1 = array(pipe, w),  // stdout is a pipe that the child will
 write to
2 = array(file, /tmp/error-output.txt, a) // stderr is a file
 to write to
 );

 $kmz_process = proc_open('zip',$descriptorAssignments,$pipes);

 if (is_resource($kmz_process))
 {
fwrite($pipes[0],$kml_string);
fclose($pipes[0]);

$kmz_content = stream_get_contents($pipes[1]);

fclose($pipes[1]);

$return_value = proc_close($kmz_process);

//  Only outputting data to ensure it is a properly formatted zip file
//  Normally, a SOAP service will sent the data as a base64 encoded
 payload
$output_file = fopen('ndfdViaPipe.kmz','w');
fwrite($output_file,$kmz_content);
fclose($output_file);
 }

 ?

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] isset($a-b) even if $a-b = null

2007-08-17 Thread Michael Preslar
On 8/17/07, Olav Mørkrid [EMAIL PROTECTED] wrote:
 how do i test if a property of a stdclass object is set, even if its
 value is null, similar to how array_key_exists() works for arrays.

 the following method fails:

   $a-b = null;
   if(isset($a-b))
 echo yes;

 and property_exists() seems only to work for defined objects.

 hope someone can help. thanks!

Seems your asking for something similar to perl's exists() function..
Best I can come up with is...

$a-b = null;

if (is_null($a-b) || isset($a-b)) {
print yes;
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: isset($a-b) even if $a-b = null

2007-08-17 Thread Michael Preslar
Found something.

For class variables..

http://us.php.net/manual/en/function.property-exists.php

class a {
  var $b;
}

if (property_exists('a','b')) {
  print yes\n;
}


On 8/17/07, Olav Mørkrid [EMAIL PROTECTED] wrote:
 the test i need should give the following results:

 - FALSE when $a-b does not exist at all
 - TRUE when $a-b = null
 - TRUE when $a-b = any value

 empty() gives true for both $a-b = null and not setting any value, so
 that's no good.

 borokovs suggestion seems to miss the purpose.

 anyone else?

 On 17/08/07, Colin Guthrie [EMAIL PROTECTED] wrote:
  Olav Mørkrid wrote:
   how do i test if a property of a stdclass object is set, even if its
   value is null, similar to how array_key_exists() works for arrays.
  
   the following method fails:
  
 $a-b = null;
 if(isset($a-b))
   echo yes;
  
   and property_exists() seems only to work for defined objects.
  
   hope someone can help. thanks!
 
  You can try:
   unset($a-b)
 
  Or change isset() to empty().
 
  empty() catches more than isset() e.g. '' (empty string), false, 0 etc.
  are considered empty. Depending on your logic it can still be very
  useful. It is a language construct rather than a function so it's also
  efficient.
 
  Col
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] cant get if logic correct..

2007-08-15 Thread Michael Preslar
This will be of help.

http://us2.php.net/manual/en/function.is-numeric.php

On 8/15/07, Gregory Machin [EMAIL PROTECTED] wrote:
 Hi
 i have a piece of code that gets info from a comma delimited file,
 then gets each value that is to be insterted into the database 

 The variabls must only contain numbers and must not be null ..
 but the  logic i have is iether not working or there are some hidden
 characters creeping in because it is processing the data ... how can i
 do this better ?


 for($i=2;$i$arrsize;$i++){
   $parts=explode(,,$lines[$i]);
   $stnr=$parts[0];
   $subj=$parts[1];
   $mark=$parts[4];
 if (($stnr) and ($subj) and ($mark)){
//do alot of something lol
}
}

 --
 Gregory Machin

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] QuickTime question

2007-08-15 Thread Michael Preslar
I'm not sure if this would be of help or not, but have you tried
setting 'Content-disposition: inline' in the header?

On 8/15/07, tedd [EMAIL PROTECTED] wrote:
 At 4:32 PM +0100 8/15/07, Stut wrote:
 tedd wrote:
 Given:
 
 http://www.webbytedd.com/bb/ice/
 
 How can I play the movie inside the page instead of going to another page?
 
 I know that I could use phpclasses, but that seems an overkill.
 
 I think something like this --
 
 $file_source = 'ice-fishing.mov';
 $size = filesize($file_source,,);
 
 header('Pragma: public');
 header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
 header('Cache-Control: must-revalidate, pre-check=0, post-check=0,
 max-age=0');
 header('Content-Transfer-Encoding: none');
 header(Content-type: video/quicktime);
 header(Content-Length:  . $size);
 
 -- but it's falling short.
 
 Something like this...
 
 object classid=clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B
 codebase=http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0;
 height=153 width=321
param name=src value=ice-fishing.mov
param name=controller value=true
param name=autoplay value=true
embed src=ice-fishing.mov
 pluginspage=http://www.apple.com/quicktime/download/;
 controller=true autoplay=true height=153 width=321
 /object
 
 I'm sure there are lots of tutorials on the web regarding the
 details - I just nicked this code from
 http://www.apple.com/trailers/fox/thesimpsonsmovie/trailer1_small.html
 
 -Stut

 -Stut:

 That certainly works, --

 http://www.webbytedd.com/bb/ice1/

 -- but I was hoping for something in the php realm.

 Thanks,

 tedd


 --
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Friday morning brain farts....

2007-08-10 Thread Michael Preslar
Here's what I use to watch my apache logs.. Looks for php errors,
notices, and warnings, seg faults, etc.. Grabs the stats for the prior
hour and spits them to stdout.. Pipe that to mutt or sendmail and
youve got an hourly cron.. Check the command line options for other
good stuff.. Only catch: This is written in perl..

http://www.michaelpreslar.com/hour_errorlog.pl.txt

 Should probably say that it also renames the log file, graceful's
 Apache, zips the old log and moves it to an archive file server. Rob's
 script above, used without something that starts a new log will result
 in ever-increasing emails.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problem with getting time in EST

2007-08-04 Thread Michael Preslar
if time() is always 1 hour behind what you want, why not

time() + 3600 // 60 seconds * 60 minutes

On 8/4/07, Crab Hunt [EMAIL PROTECTED] wrote:
 Hi,
 I need to get the current time in EST timezone while my current timezone is
 CEST. I use the function :

 date_default_timezone_set('EST')


 But now the time that I get is 1 hour less than the time in EST (
 http://wwp.greenwichmeantime.com/time-zone/usa/eastern-time/), probably
 without taking care of the daylight savings time (DST)... Can anyone help me
 out how to solve it, its an urgent issue for me.

 Thanks a lot in advance,
 regards,
 Rakesh


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Rejecting File Upload

2007-08-04 Thread Michael Preslar
Check http://www.php.net/file_upload .. In specific, the MAX_FILE_SIZE
form field .. And then check
http://us3.php.net/manual/en/ini.core.php#ini.upload-max-filesize

On 8/4/07, php mail [EMAIL PROTECTED] wrote:
 Hi All,

 How do I prior check file's size in server side before the upload process
 begin ?

 Regards,

 Feris


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] I'm prepared to feel like an idiot... But I just simply need the answer :)

2007-08-01 Thread Michael Preslar
 @mysql_connect('localhost', 'user', 'password') or die(Cannot
 connect to DB! . mysql_error());
..
 cannot connect to DB!Can't connect to local MySQL server through
 socket '/var/mysql/mysql.sock' (2)qs:/volumes/raider/webserver/
 documents/tests/ticklers japruim$

MySQL is running right? (I know, silly question, but have to make sure)

If it is.. grep sock /etc/my.ini .. Bet the socket file its creating
is in /tmp or /var/lib/mysql

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Question about passing date in sql...

2007-08-01 Thread Michael Preslar
 I know it has to do with date='`date +%Y%m%d`', because if I remove it
 works.

Are you trying to use perl's back tic operator in php here?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Job Opportunity: PHP Developer

2007-07-31 Thread Michael Preslar
Dont know if this would be of any use to anyone but.. meh..

I interviewed with a company called The Selling Source, based out of
Las Vegas, for a PHP position.. Was told They are always hiring PHP
developers.. The recruiter I had been working with made it sound like
TSS had a huge turn over rate.

I ended up find a job locally, so didnt have to move to Sin City..

On 7/31/07, tedd [EMAIL PROTECTED] wrote:
 At 12:11 PM -0400 7/31/07, Denice Fitzgerald wrote:
   The company is a technology innovator
 and are known for being the top technology company in Las Vegas.

 And this technology innovator requires people on-site to program?
 Sounds like typical technology to me.

 Why can't one of these technology innovator companies move next door to me?

 Cheers,

 tedd
 --
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php