Click here to Skip to main content
15,891,431 members

Comments by Uilleam (Top 14 by date)

Uilleam 5-Sep-12 10:01am View    
Just a few thoughts:
-you're opening the file to read not write as you appear to think
-what is it exactly that you think that substitution will do? I'm only guessing, but do you want $array1[0] to be replaced by $array2[0], and so on pairwise in the array? If so, that's not how s/// works. You will need to use a loop through your arrays, but since you don't show what didn't work in your attempt I can't help you further with that.

In general, the clearer your question the better the answer will be. As much as I'm happy to help, I don't have the time to code up solutions, make up sample data etc. If you provide a lot more on what your input is, what you tried, what output you got and what output you desire, you'll probably get more help.
Uilleam 9-Aug-12 10:16am View    
I'm still not entirely clear on your task. In your example do you mean to say that the segment you labelled as "range to be extracted" which is delimited by lines of "P5X98A-PGM-INITS" is to be removed from its existing location, then inserted after the line "PERFORM P5X98A-ABC-LIMIT." (which itself should be commented out by an asterisk? Can you generalize this something like "any chunk of lines surrounded by matching PGM lines should be moved to follow the matching ABC lines (which may appear earlier or later)?

If so, I can see the temptation to do this in a rw mode as that is essentially how you would do it manually in an editor. However a better approach to me would be to do two passes:
-first extract all the PGM lines and their associated blocks of text, as well as all the ABC lines, and store it in a couple of hashes for easy reference
-second sort through all that material and write it out in the desired order in an output file. I'd walk through the list of ABC lines and then seek the matching PGM lines and data block, write the lot out, then go on to the next ABC line you found.

Does that make sense? Bear in mind that I don't know why you're doing all this so I may not know enough to give useful advice.

good luck!
Uilleam 1-Aug-12 12:45pm View    
Agree, you need to tell us more. www:mechanize should wait for the http transaction to complete. If some javascript changes are involved on the page however, note that mechanize (without some help) won't notice.
Uilleam 4-May-12 12:18pm View    
I've not done it so I can't authoritatively give an answer of YES, but I don't see why not. The complexity will come in deciding what the bandwidth actually is for a given phone at a given time. My android phone is plenty fast on wifi (e.g streaming HDTV), but not so much on the cell carrier, and real bandwidth via cell will depend a lot on the company supplying service, and the circumstances of the call. So I think you can do this, but you need to either detect the bandwidth (if you have a client installed on the phone) or allow the user to choose a bandwidth somehow. Besides, they may not want highest quality even if the bandwidth is available as they may be paying a lot for data.
Uilleam 2-Dec-11 16:09pm View    
My suggestion is that if you don't know anything about the domain of the application, you better get some (really a lot) of input from key stakeholders before you start building things. You will save yourself a lot of wasted time if you plan before you try to build. If you're doing this as a job, get your specifications in writing, in detail, preferably signed in blood ;-)