Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
string too long for function
Old 02-03-2008, 09:01 AM string too long for function
Average Talker

Posts: 20
Trades: 0
-fixed-

Last edited by koolaid; 02-06-2008 at 07:29 AM..
koolaid is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-03-2008, 10:31 AM Re: string too long for function
Ultra Talker

Posts: 483
Trades: 0
I've thrown around strings a lot longer than that before without problems.

Maybe it's not that the string is 'too long' for a function, but that it's your code in particular that's choking on the string... it would help if you showed it to us.
__________________

Please login or register to view this content. Registration is FREE
TwistMyArm is offline
Reply With Quote
View Public Profile
 
Old 02-03-2008, 12:42 PM Re: string too long for function
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
You'd need to provide the function so that a Big-O analysis can be done on it.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 02-03-2008, 02:33 PM Re: string too long for function
Average Talker

Posts: 20
Trades: 0
-fixed-

Last edited by koolaid; 02-06-2008 at 07:29 AM..
koolaid is offline
Reply With Quote
View Public Profile
 
Old 02-03-2008, 02:41 PM Re: string too long for function
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
My point was that you'd need to provide the function. You'd have to be trained or do a bit of study to do such an analysis. Fortunately for you, I and (most likely) others have learned about such analysis, so that when you post here, you don't have to do it.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 02-04-2008, 12:41 AM Re: string too long for function
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
O notation (Big O, Big omega, Big theta analysis) are ways of estimating the runtime of a chunk of code. Its usually used in the context of data structures as a way to figure out the run time of a method based on how many items are in the structure. So if you have an array of n items if you wanted to look at every item it would take O(n) time. Its pretty simple once its explained to you. Every CS major at my university picks it up in their first quarter.

That being said I'm guessing that your problem resides in the way you are handling your strings rather than your run time. Unless you are performing a large number of operations based on how long your URL is I don't think its an o-notation kind of problem, but rather a syntax or design problem.

Post your code and I'm sure someone can pick out your problem.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 02-04-2008, 01:03 AM Re: string too long for function
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
Hmm... I only covered basic O notation in CIS. I covered O notation in greater detail in my graduate-level numerical linear algebra (using Dr. Watkins "Fundamentals of Matrix Computations"). It can be very complicated for people, especially if their background isn't that strong in mathematics. Either way, providing your code will help significantly. Don't underestimate the complexity of Big-O as it's more than just how many items are in your structure, but how your stucture processes the items in your structure. Even if there are n items, the routine can be O(e^n) or much worse.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE

Last edited by JeremyMiller; 02-04-2008 at 01:05 AM..
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 02-04-2008, 02:15 AM Re: string too long for function
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Quote:
Originally Posted by JeremyMiller View Post
Don't underestimate the complexity of Big-O as it's more than just how many items are in your structure, but how your stucture processes the items in your structure. Even if there are n items, the routine can be O(e^n) or much worse.
Right. But in the case of performing a linear search in a set of n items using a flat data structure like an array your average case search time (in o notation) is O(n). Personally I would love to see a search algorithm poor enough to perform in O(e^n) just for fun

But to get back on topic... I'm guessing that the problem with his code has to deal with a syntax error or something like that, unless he is trying to sort to characters in the url lexographically using bubble sort
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 02-04-2008, 02:23 AM Re: string too long for function
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
I'll have to check on the O(e^n) code. I remember crossing that once and it's probably more complicated than most here will understand -- I'll PM you when I find it, but I'm drunk tonight so O(e^n) stuff would be outside my brain's capacity right now.

If it were a syntax error that he was experiencing, then it wouldn't work for short URLs.... It will be interesting to see the function, however, as we could then discuss it's Big-O equivalence. As a bit of a side note, I see nothing in the original post which suggests a linear calculation -- am I missing something? What suggested to me that there was an issue with calculational complexity is that with a short URL (as provided) it worked in a short time but with a moderate URL (as provided) it didn't. That screams calculational complexity to me.

For those others who may be reading, not all Big-O stuff is related to one variable. Having O(m*n) is just as possible as well where m != n. There could be more than one variable affecting the overall complexity. Also, Big-O simplifies things down substantially. For example, if the calculated complexity was 3m*n^2 + 500n + 4000000, then the Big-O notation would only be O (n^2) as the other values are irrelevant as n->infinity (unless, m->infinity and n does not). [Now, I might be a bit wrong there as the alcohol has clearly set in and then the Big-O notation would be O(m*n^2) where m or n approaches infinity, but again, that depends on the nature of the issue involved.] The true key, however, is "how your stucture processes the items in your structure."

Oh, I guess I should add that the problem may only be O(n), but the function may be poorly written and be O(n^3). That would be something we would, most likely, be able to help correct.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE

Last edited by JeremyMiller; 02-04-2008 at 02:28 AM..
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 02-04-2008, 07:09 AM Re: string too long for function
Average Talker

Posts: 20
Trades: 0
-fixed-

Last edited by koolaid; 02-06-2008 at 07:28 AM..
koolaid is offline
Reply With Quote
View Public Profile
 
Old 02-04-2008, 10:36 AM Re: string too long for function
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
Oh, I'm disappointed. I don't know that service. I thought it was a routine you'd written. BTW: You're right -- don't post PEAR code here! You'd probably run out of chars for the post anyway.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 02-04-2008, 10:55 AM Re: string too long for function
Average Talker

Posts: 20
Trades: 0
-fixed-

Last edited by koolaid; 02-06-2008 at 07:29 AM..
koolaid is offline
Reply With Quote
View Public Profile
 
Old 02-04-2008, 10:56 AM Re: string too long for function
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
If it doesn't contain personal information, could you post your solution here for others to see?
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 05-26-2008, 03:07 AM Re: string too long for function
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
Been busy, but apparently I got my base crossed. Seems like I had in the back of my head O(n log(n)) instead of O(e^n) which is obviously what came out of my head. Anyway, there's a bit about it at http://www.leepoint.net/notes-java/a...-oh/bigoh.html which is where I found the reminder.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 05-26-2008, 10:18 PM Re: string too long for function
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
please Do Not Edit Original Post When Question Has Been Answered
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to string too long for function
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.44778 seconds with 12 queries