php-general Digest 7 Nov 2009 12:56:27 -0000 Issue 6431

Topics (messages 299687 through 299693):

Re: shell_exec fails to compile java class?
        299687 by: דניאל דנון

Re: Carriage Returns
        299688 by: Dan Shirah

Re: Imagick question
        299689 by: Jason Young

Insuring proper use of a SITE and it's pages...
        299690 by: Don Wieland
        299691 by: John List

Re: Preview button to show PDF without submitting post data?
        299692 by: Dave M G
        299693 by: Ashley Sheridan

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:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
Where are you trying to write text.txt? Are you setting a current working
directory in your batch file? Do you have write permission in this
directory?
(copied it to make it easier to understand my answer)
In the same folder.
Yes, there is a "cd javafiles"
Yes.

I know its not a permission / directory sort of things, since when there are
no errors - the .class compiled java files are created properly.

On Fri, Nov 6, 2009 at 9:11 PM, John List <[email protected]> wrote:

> ????? ???? wrote:
>
>> Hello, Thank you - I've managed to do that using a bat file like you
>> suggested.
>>
>> Only problem is that:
>>
>> When I try to call:
>> C:\\Java\bin\javac.exe  Tester.java > test.txt
>> (Which should run Tester.java and log any results into test.txt),
>>
>> When there are compilation errors and this command returns results -
>> test.txt stays empty.
>>
>> Any suggestions?
>>
>>
>
> Where are you trying to write text.txt? Are you setting a current working
> directory in your batch file? Do you have write permission in this
> directory?
>
> john
>
>  On Wed, Nov 4, 2009 at 4:34 PM, Nathan Rixham <[email protected]> wrote:
>>
>>
>>
>>> ????? ???? wrote:
>>>
>>>
>>>
>>>> Hello!
>>>>
>>>> I need to use shell_exec (or any other similar function) in order to
>>>> compile
>>>> a java class-file.
>>>>
>>>> I have all the needed components installed on my computer (Windows XP
>>>> with
>>>> Java SDK) - I can use "java c:\path...." in order to compile using
>>>> Start->Run.
>>>>
>>>> When I try to do the same with shell_exec or `` it returns null and it
>>>> doesn't compiles. Even when there are errors - it doesn't show them at
>>>> all.
>>>>
>>>> I've tried to use instead of "java c:\path..." the full java command
>>>> line
>>>> compiler path but it didn't work either.
>>>>
>>>>
>>>> When I try functions such as "echo test" it works.
>>>>
>>>>
>>>> Clearly I'm missing here something - problem is... what?
>>>>
>>>>
>>>>
>>>>
>>> create an ant builder or .bat and call that instead; most likely because
>>> the environment isn't set up correctly when executing via php; thus when
>>> using ant or bat you can set everything up correctly as needed.
>>>
>>> always use PHP on linux but permissions and the scope / permissions of
>>> the
>>> account php runs under may come in to play?
>>>
>>> nathan
>>>
>>>
>>>
>>
>>
>>
>>
>>
>
>


-- 
Use ROT26 for best security

--- End Message ---
--- Begin Message ---
>
> My guess is that you are getting an SQL error returned to you.  What does
> that
> say?  Is it talking about a broken SQL statement?
>
> Also, an example of the actual insert statement with example data would be
> helpful.
>
>
>

I'm getting the generic error message: Prepare fails (E [SQLSTATE=IX 000
SQLCODE=-282])

My insert statement when echo'd out using print_r($insert) is nothing
complex.

INSERT INTO my_table VALUES (0, 'This is my text. When I use carriage
returns it breaks. I am not sure why.')

--- End Message ---
--- Begin Message --- I think to do this effectively, you'll need to create two images, as such (adapting from your code):

<?php
        $width = 150;
        $height = 150;
        $background = 'white';

        $im = new Imagick();
        $im->newImage($width, $height, $background);

        $thumb = new Imagick('original/' . $filename);
        $thumb->thumbnailImage($width, $height, true);
        $thumb->sharpenImage(50, 1);
        $thumb->roundCorners(5, 5, 7);

        $im->compositeImage($thumb, Imagick::COMPOSITE_OVER, 0, 0);
        $im->setImageFormat('jpeg');
        $im->flattenImages();

        $im->writeImage('thumbnail/' . $filename);
/* Or display directly to screen
header("Content-Type: image/jpeg");
echo $im;
*/
        $im->clear();
        $im->destroy();
        $cv->clear();
        $cv->destroy();
?>

That seems to be the only way I can find to control which colors are used.

-Jason

Ashley M. Kirchner wrote:
Ashley Sheridan wrote:
Fill the background with white before you create the corners.
   Well, I tried that, with no luck.  This is my actual code:

     $width = 150;
     $height = 150;
     $im = new Imagick('original/' . $filename);
     $im->thumbnailImage($width, $height, true);
     $im->sharpenImage(50, 1);
     $im->setImageBackgroundColor('white');
     $im->roundCorners(5, 5, 7);
     $im->setImageFormat('jpeg');
     $im->writeImage('thumbnail/' . $filename);
     $im->clear();
     $im->destroy();


--- End Message ---
--- Begin Message ---
Hello,

I am in the process of setting up a function to help with proper page navigation/processes and page access. Basically, the way I was hoping it could work is every time I load a page I would set a Last Page SESSION variable with the file name. Then when another page is targeted, I would refer to that session variable to make sure that the navigation is allowed and if the user's level allows access to the page (to guard against hacking, history, and bookmarks). If the two test are not invoked, it would then reset the "LastPage" with that current page. I am running into issue with using the BACK button and history.

Bottom line is I want the $_SESSION['LastPage'] with the current pages name regardless of how it's accessed. How do developer's handle this? The function is below:



function Validate_Page_Nav($db, $CurrentPage, $LastPage, $ErrorPage) {

$resul = $db->query("SELECT * FROM Page_Access WHERE URI = '{$CurrentPage}'") or die("failed to get access data");
$page_access = $resul->fetch_assoc();
$pa = $page_access['User_Level'];
$URI_access = explode(",", $pa);

if($_SESSION['Last_Page'] != $LastPage) {               
header("location: {$ErrorPage}?message=Unable to update user information.");
                exit();
                }

if(!in_array($_SESSION['Staff_level'], $URI_access)) {
header("location: {$ErrorPage}?message=Unable to update user information.");
                exit();
                }
                
                $_SESSION['Last_Page'] = $CurrentPage;
                
}


Thanks for any advice you can offer.

Don Wieland
D W   D a t a   C o n c e p t s
~~~~~~~~~~~~~~~~~~~~~~~~~
[email protected]
Direct Line - (949) 305-2771

Integrated data solutions to fit your business needs.

Need assistance in dialing in your FileMaker solution? Check out our Developer Support Plan at:
http://www.dwdataconcepts.com/DevSup.html

Appointment 1.0v9 - Powerful Appointment Scheduling for FileMaker Pro 9 or higher
http://www.appointment10.com

For a quick overview -
http://www.appointment10.com/Appt10_Promo/Overview.html


--- End Message ---
--- Begin Message ---
Don Wieland wrote:
... I am running into issue with using the BACK button and history.

Bottom line is I want the $_SESSION['LastPage'] with the current pages name regardless of how it's accessed.

Using the "Back" button doesn't necessarily produce a new request to the server. If you want to track such visits at the server, I think the conventional wisdom is to deliver a dummy page with a redirect to the real "payload" page. I believe the redirect will be invoked regardless of whether the dummy page was arrived at by the "Back" button or not.

(But frankly it's been a while since I fooled with this so I may be wrong.)

John


Don Wieland wrote:
Hello,

I am in the process of setting up a function to help with proper page navigation/processes and page access. Basically, the way I was hoping it could work is every time I load a page I would set a Last Page SESSION variable with the file name. Then when another page is targeted, I would refer to that session variable to make sure that the navigation is allowed and if the user's level allows access to the page (to guard against hacking, history, and bookmarks). If the two test are not invoked, it would then reset the "LastPage" with that current page. I am running into issue with using the BACK button and history.

Bottom line is I want the $_SESSION['LastPage'] with the current pages name regardless of how it's accessed. How do developer's handle this? The function is below:



function Validate_Page_Nav($db, $CurrentPage, $LastPage, $ErrorPage) {

$resul = $db->query("SELECT * FROM Page_Access WHERE URI = '{$CurrentPage}'") or die("failed to get access data");
$page_access = $resul->fetch_assoc();
$pa = $page_access['User_Level'];
$URI_access = explode(",", $pa);

if($_SESSION['Last_Page'] != $LastPage) {
header("location: {$ErrorPage}?message=Unable to update user information.");
exit();
}

if(!in_array($_SESSION['Staff_level'], $URI_access)) {
header("location: {$ErrorPage}?message=Unable to update user information.");
exit();
}

$_SESSION['Last_Page'] = $CurrentPage;

}


Thanks for any advice you can offer.

Don Wieland
D W D a t a C o n c e p t s
~~~~~~~~~~~~~~~~~~~~~~~~~
[email protected]
Direct Line - (949) 305-2771

Integrated data solutions to fit your business needs.

Need assistance in dialing in your FileMaker solution? Check out our Developer Support Plan at:
http://www.dwdataconcepts.com/DevSup.html

Appointment 1.0v9 - Powerful Appointment Scheduling for FileMaker Pro 9 or higher
http://www.appointment10.com

For a quick overview -
http://www.appointment10.com/Appt10_Promo/Overview.html




--- End Message ---
--- Begin Message ---
Fernando,

Thank you for responding.

> You could just open in a new window a php script that generates the "preview" 
> pdf with a content-type header for pdf.

Yes, but how would the form data be carried over to the new window?

The thing is that I have all this form data that the user has entered,
and before they submit it to be stored in the database, they want to see
it in a PDF file.

If I just point the link to a new script that generates the PDF, won't
the form data be lost?

Or is can I attach Post data to the new window?

-- 
Dave M G

--- End Message ---
--- Begin Message ---
On Sat, 2009-11-07 at 14:59 +0900, Dave M G wrote:

> Fernando,
> 
> Thank you for responding.
> 
> > You could just open in a new window a php script that generates the 
> > "preview" pdf with a content-type header for pdf.
> 
> Yes, but how would the form data be carried over to the new window?
> 
> The thing is that I have all this form data that the user has entered,
> and before they submit it to be stored in the database, they want to see
> it in a PDF file.
> 
> If I just point the link to a new script that generates the PDF, won't
> the form data be lost?
> 
> Or is can I attach Post data to the new window?
> 
> -- 
> Dave M G
> 


The form data doesn't have to be lost. You can post it to an
intermediate script that creates the PDF and holds the data. You could
use Javascript to change the original form slightly so that it opens in
a new window (set a target attribute) and then remove it immediately
after. There are quite a few ways you can do all of this.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---

Reply via email to