php-general Digest 15 Aug 2008 12:33:46 -0000 Issue 5625

Topics (messages 278105 through 278124):

Re: parsing form with a website question...
        278105 by: bruce
        278106 by: tedd
        278108 by: Chris
        278109 by: Robert Cummings

Re: Passing variable to a page in a frameset
        278107 by: tedd
        278124 by: Dan Shirah

Removing an element from the middle of an mdlti-dimentsional array
        278110 by: Don
        278111 by: mike
        278112 by: Don
        278113 by: mike
        278114 by: Don
        278119 by: Simcha Younger

Re: PHP editor for linux
        278115 by: Michael S. Dunsavage
        278117 by: Ross McKay
        278118 by: Lester Caine
        278120 by: Mario Guenterberg

Re: On one of my computers, php can't see an external javascript I included
        278116 by: Chris

import XLS sheet into DB
        278121 by: Alain R.
        278122 by: Mario Guenterberg
        278123 by: Jason Pruim

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 ---
rob,

i'm fully aware of the issues, and for the targeted sites that i'm focusing
on, i can employ strategies to prune the tree... but the overall issue is
that i'm looking for a tool/app/process that does what i've described.

the basic logic is that the app needs to use a config file, and that the app
should somehow find the requisite form using perhaps xpath, in combination
with some kind of pattern recognition/regex functionality...

once the app has the form, it can then get the underlying "stuff"
(selects/lists/items, etc.. which will form the basis for the querystrings
to the form action...

ain't life grand!!

thanks...



-----Original Message-----
From: Robert Cummings [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 14, 2008 4:57 PM
To: bruce
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] parsing form with a website question...


On Thu, 2008-08-14 at 15:47 -0700, bruce wrote:
> Hi guys...
>
> Got a question that I figured I'd ask before I reinvent the wheel.
>
> A basic website has a form, or multiple forms.  within the form, there
might
> be multiple elements (lists/select statements, etc...). each item would
have
> a varname, which would in turn be used as part of the form action, to
create
> the entire query...
>
> sort of like:
> form action=test.php?
>  option
>   name=foo
>   foo=1
>   foo=2
>   foo=3
>   foo=4
>  /option
>
>  option
>   name=cat
>   cat=1
>   cat=2
>   cat=3
>  /option
> /form
>
> so you'd get the following urls in this psuedo example:
>  test.php?foo=1&cat=1
>  test.php?foo=1&cat=2
>  test.php?foo=1&cat=3
>  test.php?foo=2&cat=1
>  test.php?foo=2&cat=2
>  test.php?foo=2&cat=3
>  test.php?foo=3&cat=1
>  test.php?foo=3&cat=2
>  test.php?foo=3&cat=3
>  test.php?foo=4&cat=1
>  test.php?foo=4&cat=2
>  test.php?foo=4&cat=3
>
> i'm looking for an app that has the ability to parse any given "form" on a
> web page, returning the complete list of possible url combinations based
on
> the underlying elements that make up/define the form...
>
> anybody ever seen anything remotely close to this...???
>
> i've been research crawlers, thinking that this kind of functionality
would
> already exist, but so far, no luck!

A little algorithm analysis would learn you that to do so would require
storage space on an exponential scale... as such you won't find it.
Also, what would you put into text/textarea fields? I've heard Google
has begun experiments to index the "deep" web, but they just take
somewhat educated guesses at filling in forms, not at expanding the
exponential result set. For a simple analysis of the problem. Take 2
select fields with 2 options each... you have 4 possible outcomes (2 *
2). Now take 3 selects lists with 3 items, 4 items, and 5 items. You now
have 60 possible outcomes. From this it is easy to see the relation ship
is a * b * c * ... * x. So take a form with 10 select fields each with
10 items. That evaluates to 10^10 = 10000000000. In other words, with a
mere 10 drop down selects each with 10 items, the solution space
consists of 10 billion permutations. Now lets say each item costs
exactly 1 byte to store the answer, and so you need 10 bytes to store
one particular solution set. That's 100 billion bytes AKA 100 metric
gigabytes... remember that was just 1 form.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
At 7:57 PM -0400 8/14/08, Robert Cummings wrote:
On Thu, 2008-08-14 at 15:47 -0700, bruce wrote:
-snip- That's 100 billion bytes AKA 100 metric
gigabytes... remember that was just 1 form.

Cheers,
Rob.

Killjoy.  :-)

He could have had a lot of fun figuring that out.

tedd

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

--- End Message ---
--- Begin Message ---
bruce wrote:
rob,

i'm fully aware of the issues, and for the targeted sites that i'm focusing
on, i can employ strategies to prune the tree... but the overall issue is
that i'm looking for a tool/app/process that does what i've described.

the basic logic is that the app needs to use a config file, and that the app
should somehow find the requisite form using perhaps xpath, in combination
with some kind of pattern recognition/regex functionality...

once the app has the form, it can then get the underlying "stuff"
(selects/lists/items, etc.. which will form the basis for the querystrings
to the form action...

Don't know of anything that does this off hand but it'd be a good project for a security check app :) See what values/options the form accepts and what it fails with..

--
Postgresql & php tutorials
http://www.designmagick.com/


--- End Message ---
--- Begin Message ---
On Thu, 2008-08-14 at 21:39 -0400, tedd wrote:
> At 7:57 PM -0400 8/14/08, Robert Cummings wrote:
> >On Thu, 2008-08-14 at 15:47 -0700, bruce wrote:
> >-snip- That's 100 billion bytes AKA 100 metric
> >gigabytes... remember that was just 1 form.
> >
> >Cheers,
> >Rob.
> 
> Killjoy.  :-)
> 
> He could have had a lot of fun figuring that out.

He was lookig for a premade solution... it didn't seem like he wanted to
figure it out :)

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
At 4:06 PM -0500 8/14/08, george wrote:

Thank you for taking the time to help me with this, I really appreciate it!

- jody


Make it easy on yourself and try this:

http://sperling.com/examples/search/

Cheers,

tedd

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

--- End Message ---
--- Begin Message ---
>
> I apologize for my ignorance, I don't really know much about
> javascript. When I add all that into my form page, when I submit the
> form, it just replaces the page I was on with the form results, rather
> than in the new frame page. I'm assuming I need to put the url for the
> frameset page in that code somewhere. Where does it go? And, which
> part do I replace with the frame name on that frameset page?
>
> Thank you for taking the time to help me with this, I really appreciate it!



Let's look at the code:

//var1 and var2 are the search criteria the user entered in your search
form(You may have more or less)
function submitForm(var1,var2) {

//top.leftFrame is how you set the focus to the frame you want.  leftFrame
could be different on your system...whatever you named the frame.

//top.leftFrame.document.my_search.text1.value=var1 assumes the form name in
the frame you want data in is named
//my_search and it givs the text object text1 the value of var1 from your
search form
top.leftFrame.document.my_search.text1.value = var1;

//top.leftFrame.document.my_search.text2.value=var2 assumes the form name in
the frame you want data in is named
//my_search and it givs the text object text1 the value of var2 from your
search form
 top.leftFrame.document.my_search.text2.value = var2;

//top.leftFrame.document.my_search.submit() will submit the form in your
target frame then you can use the $_POST values throughout the frame
 top.leftFrame.document.my_search.submit();

//document.search_form.submit() will submit your search page. I use this so
I can reuse the $_POST values to display the search criteria after submit.
 document.search_form.submit();
}

--- End Message ---
--- Begin Message ---
Hi,

Let's say I have the following array:

$myArray = array(array('1','2','3'), array('4','5','6'), array('7','8','9'), 
array('10','11','12'));

How do I remove say the second element?

I have tried: $myArray = array_splice($myArray, 1, 1);

But this seems to remove the second element as well as all the following 
elements and I am left with:

$myArray = array(array('1','2','3'));

when I really want:

$myArray = array(array('1','2','3'), array('7','8','9'), 
array('10','11','12'));


Thanks,
Don 



--- End Message ---
--- Begin Message ---
Can't you unset() it? Sorry for top posting I'm on an iPhone

On Aug 14, 2008, at 7:30 PM, "Don" <[EMAIL PROTECTED]> wrote:

Hi,

Let's say I have the following array:

$myArray = array(array('1','2','3'), array('4','5','6'), array('7','8','9'),
array('10','11','12'));

How do I remove say the second element?

I have tried: $myArray = array_splice($myArray, 1, 1);

But this seems to remove the second element as well as all the following
elements and I am left with:

$myArray = array(array('1','2','3'));

when I really want:

$myArray = array(array('1','2','3'), array('7','8','9'),
array('10','11','12'));


Thanks,
Don



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


--- End Message ---
--- Begin Message ---
Won't unset() destroy the entire array?

"mike" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Can't you unset() it? Sorry for top posting I'm on an iPhone
>
> On Aug 14, 2008, at 7:30 PM, "Don" <[EMAIL PROTECTED]> wrote:
>
>> Hi,
>>
>> Let's say I have the following array:
>>
>> $myArray = array(array('1','2','3'), array('4','5','6'), 
>> array('7','8','9'),
>> array('10','11','12'));
>>
>> How do I remove say the second element?
>>
>> I have tried: $myArray = array_splice($myArray, 1, 1);
>>
>> But this seems to remove the second element as well as all the  following
>> elements and I am left with:
>>
>> $myArray = array(array('1','2','3'));
>>
>> when I really want:
>>
>> $myArray = array(array('1','2','3'), array('7','8','9'),
>> array('10','11','12'));
>>
>>
>> Thanks,
>> Don



--- End Message ---
--- Begin Message ---
Not on the specific sub element. I.e unset($array[2][0])

On Aug 14, 2008, at 8:08 PM, "Don" <[EMAIL PROTECTED]> wrote:

Won't unset() destroy the entire array?

"mike" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Can't you unset() it? Sorry for top posting I'm on an iPhone

On Aug 14, 2008, at 7:30 PM, "Don" <[EMAIL PROTECTED]> wrote:

Hi,

Let's say I have the following array:

$myArray = array(array('1','2','3'), array('4','5','6'),
array('7','8','9'),
array('10','11','12'));

How do I remove say the second element?

I have tried: $myArray = array_splice($myArray, 1, 1);

But this seems to remove the second element as well as all the following
elements and I am left with:

$myArray = array(array('1','2','3'));

when I really want:

$myArray = array(array('1','2','3'), array('7','8','9'),
array('10','11','12'));


Thanks,
Don



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


--- End Message ---
--- Begin Message ---
Yup, thanks.

Also execute:
   $array = array_values(array)
in order to fix the indexes

----- Original Message ----- From: "mike" <[EMAIL PROTECTED]>
To: "Don" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, August 14, 2008 11:16 PM
Subject: Re: [PHP] Removing an element from the middle of an mdlti-dimentsional array


Not on the specific sub element. I.e unset($array[2][0])

On Aug 14, 2008, at 8:08 PM, "Don" <[EMAIL PROTECTED]> wrote:

Won't unset() destroy the entire array?

"mike" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Can't you unset() it? Sorry for top posting I'm on an iPhone

On Aug 14, 2008, at 7:30 PM, "Don" <[EMAIL PROTECTED]> wrote:

Hi,

Let's say I have the following array:

$myArray = array(array('1','2','3'), array('4','5','6'),
array('7','8','9'),
array('10','11','12'));

How do I remove say the second element?

I have tried: $myArray = array_splice($myArray, 1, 1);

But this seems to remove the second element as well as all the following
elements and I am left with:

$myArray = array(array('1','2','3'));

when I really want:

$myArray = array(array('1','2','3'), array('7','8','9'),
array('10','11','12'));


Thanks,
Don



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


No virus found in this incoming message.
Checked by AVG - http://www.avg.com Version: 8.0.138 / Virus Database: 270.6.3/1611 - Release Date: 8/14/2008 6:20 AM





--- End Message ---
--- Begin Message ---
array_splice($a, 1, 1);

This will remove the second element, and reset the keys.



Simcha Younger

-----Original Message-----
From: Don [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 15, 2008 4:30 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Removing an element from the middle of an mdlti-dimentsional
array

Hi,

Let's say I have the following array:

$myArray = array(array('1','2','3'), array('4','5','6'), array('7','8','9'),

array('10','11','12'));

How do I remove say the second element?

I have tried: $myArray = array_splice($myArray, 1, 1);

But this seems to remove the second element as well as all the following 
elements and I am left with:

$myArray = array(array('1','2','3'));

when I really want:

$myArray = array(array('1','2','3'), array('7','8','9'), 
array('10','11','12'));


Thanks,
Don 



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

No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.138 / Virus Database: 270.6.3/1612 - Release Date: 14/08/2008
18:03


--- End Message ---
--- Begin Message ---
On Thu, 2008-08-14 at 10:05 -0700, It flance wrote:
> Hi,
> 
> What do you think is the best php editor for linux.
> 
> I'm using the Debian distribution.
> 
> Thanks
> 
> 
>       
> 
> 

I use geany and Quantum
-- 
Michael S. Dunsavage


--- End Message ---
--- Begin Message ---
On Thu, 14 Aug 2008 23:46:05 -0400, Michael S. Dunsavage wrote:

>I use geany and Quantum

+2 for geany (SWMBO uses it too). It's a good general-purpose text
editor and simplified IDE. Build it from SVN, as it has been moving
fairly quickly and distro packages often haven't kept up.
-- 
Ross McKay, Toronto, NSW Australia
"Nobody ever rioted for austerity" - George Monbiot

--- End Message ---
--- Begin Message ---
Boyd, Todd M. wrote:

i used to use php-eclipse + subclipse all the time; i never had to 'install 
from source' or had issues installing subclipse on top of php-eclipse...
---
Ahh... but you're in Linux. I was referring to the Windows distribution of 
Eclipse. It's Java, so I guess it wouldn't matter... but when I installed 
PHPEclipse on top of Eclipse, it broke. Big-time.

Depends on the Linux distribution.
I have matching copies of phpeclipse on my Windows and Mandriva Linux boxes. Mandriva had it in the distribution and I then updated via Eclipse without a problem. It's nice to have a development environment that I don't have to think which machine I'm on - until it comes to a file path.

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--- End Message ---
--- Begin Message ---
On Thu, Aug 14, 2008 at 07:32:13PM -0400, Eric Butera wrote:
> What sort of plugins do you use with vim?  For a while I was
> interested with it after seeing some presentations on it.  I never
> could figure out how to get it to do code completion based on methods
> of a class, it sort of jumbled all of them from a project together.  I
> also felt like it was a bit clunky jumping between files.  Using MVC
> means at least 3 files per uri so that got to be very tedious for me
> jumping between so many different files.  Any tips there?
> 
> One of my favorite parts of pdt is the fact that I can code complete
> any class in my current project or anything that I specify in my
> include path.  Also you can jump to the exact class/method by control
> clicking on it too which is a huge time saver.  Is there anything like
> this?

Hi

I use vim + some plugins and a custom configuration. It works fine
in cli and as vim-gtk under debian/ubuntu.

The Plugins are NERDTree, PDV and debugger. This and a little own
vimrc makes we wonder how powerfull vim is.

The vim installation is a standard apt-get install way installation.

You can open mutliple files with NERDTree if you use the the tab-key. 
It is easy to handle more than 3 files recently, but a bigger 
resolution on your desktop is needed ;-)

So i can coding some lines or files, press CTRL-L for syntax
checking and have a wonderfull customizable syntax highlightning.

The autocomplete function works also very well. I have downloaded
the php5 funclist from rasmus and extend it if needed. Variables and
contants defined in the file that i edit are also autocompleted.

Happy coding
Mario

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/CM d- s++: a+ C++++>$ UBL*++++$ P++ L+++ E--- W+++ N+ o-- K- w O- M-
V-- PS++ PE++ Y PGP+++ t--- 5 X++++ R++ tv- b+++ DI D++++  G++ e* h----
r+++ y++++
------END GEEK CODE BLOCK------

--- End Message ---
--- Begin Message ---
googling1000 wrote:
Edit:
I don't think Javascript is disabled on my computer.
When I tried posting the code online, I see that my js functions are
executed just fine on this one particular machine.

Hit the file directly in your browser:

http://example.com/path/to/javascript.js

what do you get?

--
Postgresql & php tutorials
http://www.designmagick.com/


--- End Message ---
--- Begin Message ---
Hi,

I would like to import content of an XLS sheet into a PostgreSQL DB (table).

How can i do that ?
thanks a lot,

A.

--- End Message ---
--- Begin Message ---
On Fri, Aug 15, 2008 at 10:29:40AM +0200, Alain R. wrote:
> Hi,
>
> I would like to import content of an XLS sheet into a PostgreSQL DB (table).
>
> How can i do that ?

Your question is not php related ;-)

Maybe, export the sheet as comma separated csv file and import it to postgresql.

Happy coding
Mario

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/CM d- s++: a+ C++++>$ UBL*++++$ P++ L+++ E--- W+++ N+ o-- K- w O- M-
V-- PS++ PE++ Y PGP+++ t--- 5 X++++ R++ tv- b+++ DI D++++  G++ e* h----
r+++ y++++
------END GEEK CODE BLOCK------

Attachment: signature.asc
Description: Digital signature


--- End Message ---
--- Begin Message ---

On Aug 15, 2008, at 4:29 AM, Alain R. wrote:

Hi,

I would like to import content of an XLS sheet into a PostgreSQL DB (table).

How can i do that ?
thanks a lot,

A.

Alain,

I haven't done it with PostgreSQL... But assuming it's not far from MySQL just save the excel file as a csv, or a tab separated file and import that. If you find away to import a strict xls file let me know, I have a project that could really benefit from that :)


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





--- End Message ---

Reply via email to